mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Improve the RL learning process
Improve the RL learning process by selecting random start point for the agent, it can help to block the agent to only learn on the selected period of time, while improving the quality of the model.
This commit is contained in:
parent
320535a227
commit
64d4a52a56
|
@ -9,6 +9,7 @@ import pandas as pd
|
|||
from gym import spaces
|
||||
from gym.utils import seeding
|
||||
from pandas import DataFrame
|
||||
import random
|
||||
|
||||
from freqtrade.data.dataprovider import DataProvider
|
||||
|
||||
|
@ -121,6 +122,9 @@ class BaseEnvironment(gym.Env):
|
|||
self._done = False
|
||||
|
||||
if self.starting_point is True:
|
||||
length_of_data = int(self._end_tick/4)
|
||||
start_tick = random.randint(self.window_size+1, length_of_data)
|
||||
self._start_tick = start_tick
|
||||
self._position_history = (self._start_tick * [None]) + [self._position]
|
||||
else:
|
||||
self._position_history = (self.window_size * [None]) + [self._position]
|
||||
|
|
Loading…
Reference in New Issue
Block a user