I am learning RL for Trading, the bot is train only for one iteration, I want to train it for multiple iterations and it's taking 4+ hours to train how can I reduce that?
Hi Himanshu,
The model is training only on one iteration since we used the 'train_on_batch' method in the run() function.
To train for multiple iterations, please use the fit method. You can pass the number of epochs as an input parameter to the fit method to define the no. of iterations for training.
Please follow this link to know more about the fit method and multiple ways to train the model.
There are many ways to reduce the training time for RL.
- You can increase the hardware arsenal either by using faster CPUs or increasing the no. of CPUs. You can also take advantage of cloud computing like AWS instances to achieve this.
- You can also try different batch_sizes to decrease the trading time. However, it would have an impact on the model performance. Please read this article to know more about the effect of batch size on training dynamics.
- You can perform parallelization by running multiple environments at once and letting the agent learn from multiple environments. This reduces the training time. Please follow this link to know more about this and also other common ways to reduce the training time.
Hope this helps!
Thank you
What goes into the fit funtion?
Hi Himanshu, you can pass the number of epochs as an input parameter to the fit method to define the no. of iterations for training as you wanted.
Please follow this link to know more about the fit method.
Thank you.