nateemma / strategies

Custom trading strategies using the freqtrade framework
329 stars 88 forks source link

Question about model training in backtest mode #9

Closed ExaByt3s closed 1 year ago

ExaByt3s commented 1 year ago

first of all thanks for sharing your code good job. My knowledge in this area of machine learning is limited. So I wanted to ask you some things that I am not have clear

is possible to divide the training timerange into groups let's say The main idea I have is to try to train the model in a period of time of 1 year but divide it into days with a number of at least 50-70 pairs --timerange=20220601-20220602 --timerange=20220602-20220603 --timerange=20220603-20220604

If I manage to make the script to run the backtesting in this way the model will be loaded resumed training in the backtest mode (it will continue learning?). It seems like a basic question but as I said I don't have much knowledge in this area. As far as I see the model should continue learning based on the new ranges, (but I want to be sure in this).

my doubt about this comes after trying to train the model in a range of 3 months with about 70 pairs and the training stopped, I understand that freqtrade keeps the historical data in mememory until the end of the backtesting process, and 3 months of data can be a lot consumption of memory . so it occurred to me that I could do the same training in that range of 3 months but daily and see how the result was but first I wanted to know if the model would learn in that sequential way and what would be the impact Negative of doing it this way.

Here are some images of the memory consumption when I start and when the process was interrupted imagen imagen

nateemma commented 1 year ago

Which strategies are you looking at? The answer is different for each family, but the quick answer is to set the flag refit_model to True (then set it back to False when you have finished training)

Cheers

Phil

On Sun, Feb 12, 2023 at 8:09 AM Exabyte @.***> wrote:

first of all thanks for sharing your code good job. My knowledge in this area of machine learning is limited. So I wanted to ask you some things that I am not have clear

is possible to divide the training timerange into groups let's say The main idea I have is to try to train the model in a period of time of 1 year but divide it into days with a number of at least 50-70 pairs --timerange=20220601-20220602 --timerange=20220602-20220603 --timerange=20220603-20220604

If I manage to make the script to run the backtesting in this way the model will be loaded resumed training in the backtest mode (it will continue learning?). It seems like a basic question but as I said I don't have much knowledge in this area. As far as I see the model, I should continue learning based on the new ranges, but I want to be sure.

my doubt about this comes after trying to train the model in a range of 3 months with about 70 pairs and the training stopped, I understand that freqtrade keeps the historical data in mememory until the end of the backtesting process, and 3 months of data can be a lot consumption of memory . so it occurred to me that I could do the same training in that range of 3 months but daily and see how the result was but first I wanted to know if the model would learn in that sequential way and what would be the impact Negative of doing it this way.

Here are some images of the memory consumption when I start and when the process was interrupted [image: imagen] https://user-images.githubusercontent.com/19945960/218322080-9831fb91-c526-43c7-92ea-3b511a0a2b8b.png [image: imagen] https://user-images.githubusercontent.com/19945960/218322113-b25b1952-6244-454b-9871-4fec1639a000.png

— Reply to this email directly, view it on GitHub https://github.com/nateemma/strategies/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD4X5YXTQC5Z7KXT6Z77KTWXEDJ7ANCNFSM6AAAAAAUZMIFBU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ExaByt3s commented 1 year ago

Thank you for answer, I will try to do what you recommend

At the moment I am exploring NNBC, then In a few days I will try the NNPredict and PCA_. but for now I'm trying to digest the basics concepts

nateemma commented 1 year ago

For NNBC* and NNPredict*, just set refit_model to True and run the strategies over the desired data. The resulting models will be cumulatively trained. Remember to reset the flag to False when you want to just run the model, rather than train it.

As an aside, there are several pre-trained models available in the models/ subdirectory

ExaByt3s commented 1 year ago

Thanks, my doubts related to this topic are solved now.