深度强化学习训练精度

我正在使用深度强化学习方法来预测时间序列行为。由于我是这方面的初学者,我的提问更多是概念性的,而非计算机编程问题。我的同事给了我以下图表,展示了使用深度强化学习对时间序列数据进行分类的训练、验证和测试精度。

enter image description here

从这个图表中可以看出,验证和测试的精度都是随机的,因此,显然代理存在过拟合现象。

但让我更惊讶的是(可能是因为缺乏知识,所以我在这里提问),我的同事是如何训练他的代理的。在这个图表的X轴上,你可以看到“epoch”数(或迭代)。换句话说,代理被多次拟合(或训练),如下面的代码所示:

#initiating the agentself.agent = DQNAgent(model=self.model, policy=self.policy, nb_actions=self.nbActions, memory=self.memory, nb_steps_warmup=200, target_model_update=1e-1, enable_double_dqn=True,enable_dueling_network=True)#Compile the agent with the Adam optimizer and with the mean absolute error metricself.agent.compile(Adam(lr=1e-3), metrics=['mae'])#there will be 100 iterations, I will fit and test the agent 100 timesfor i in range(0,100):    #delete previous environments and create new ones             del(trainEnv)           trainEnv = SpEnv(parameters)    del(validEnv)    validEnv=SpEnv(parameters)    del(testEnv)    testEnv=SpEnv(parameters)   #Reset the callbacks used to show the metrics while training, validating and testing   self.trainer.reset()   self.validator.reset()   self.tester.reset()   ####TRAINING STEP####    #Reset the training environment   trainEnv.resetEnv()   #Train the agent   self.agent.fit(trainEnv,nb_steps=floor(self.trainSize.days-self.trainSize.days*0.2),visualize=False,verbose=0)   #Get metrics from the train callback     (metrics)=self.trainer.getInfo()   #################################   ####VALIDATION STEP####   #Reset the validation environment   validEnv.resetEnv()   #Test the agent on validation data   self.agent.test(validEnv,other_parameters)   #Get the info from the validation callback   (metrics)=self.validator.getInfo()   ####################################                ####TEST STEP####   #Reset the testing environment   testEnv.resetEnv()   #Test the agent on testing data               self.agent.test(testEnv,nb_episodes=floor(self.validationSize.days-self.validationSize.days*0.2),visualize=False,verbose=0)   #Get the info from the testing callback   (metrics)=self.tester.getInfo()

根据图表和代码,我感到奇怪的是,代理被多次独立拟合,但训练精度随时间增加。似乎之前的经验在帮助代理提高训练精度。但如果环境被重置,并且代理只是再次拟合,为什么会这样呢?是否有来自之前拟合的误差反向传播,帮助代理在下一次拟合中提高精度?


回答:

被重置的是环境,而不是代理。因此,代理实际上是从每次迭代中积累经验的。

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注