【问题标题】:Deep Reinforcement Learning Training Accuracy深度强化学习训练精度
【发布时间】:2019-10-20 02:52:16
【问题描述】:

我正在使用深度强化学习方法来预测时间序列行为。我是一个新手,所以我的问题比计算机编程问题更具概念性。我的同事给了我以下图表,其中包含使用深度强化学习对时间序列数据分类的训练、验证和测试准确性。

从这张图中可以看出,验证和测试的准确率都是随机的,所以当然,代理是过拟合的。

但更让我吃惊的(可能是因为缺乏知识,这也是我在这里问你的原因),是我的同事是如何训练他的经纪人的。在这张图表的 X 轴上,您可以找到“纪元”数(或迭代次数)。换句话说,智能体被多次拟合(或训练) 如下代码:

#initiating the agent

self.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 metric

self.agent.compile(Adam(lr=1e-3), metrics=['mae'])

#there will be 100 iterations, I will fit and test the agent 100 times
for 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()

根据图表和代码对我来说奇怪的是,代理被拟合了几次,彼此独立,但训练准确度随着时间的推移而增加。似乎以前的经验正在帮助代理提高训练准确性。但是,如果环境被重置并且代理再次安装,这怎么可能呢?是否存在任何来自先前拟合的误差反向传播有助于代理在下一次拟合中提高其准确性?

【问题讨论】:

    标签: machine-learning deep-learning artificial-intelligence reinforcement-learning keras-rl


    【解决方案1】:

    环境正在重置,但代理没有。

    可学习的参数属于代理,而不是环境。所以agent的参数在所有episode中都在变化,即agent在每次拟合数据时都在学习。

    如果数据在您拟合的所有时间都相同,那么它只会使我们的代理过度拟合数据分布

    【讨论】:

      【解决方案2】:

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

      【讨论】:

      • 是否有任何来源/参考资料,我可以在其中找到有关您所说内容的更多详细信息?谢谢。
      • 我说的只是强化学习的基础知识。您可能应该关注一些关于该主题的教程/课程。随便google一下,你就会找到适合自己的:)关于agent和environment的定义,en.wikipedia.org/wiki/Reinforcement_learning第一段就够了。
      • 我已经阅读了其中的一些,但是您提供给我的这些信息对它们并不那么清楚。我没有在任何地方读到受过 x 次训练的代理每次都会更好地学习训练集。无论如何,非常感谢。
      猜你喜欢
      • 2023-02-01
      • 2020-11-24
      • 2021-07-22
      • 2020-06-30
      • 2018-11-05
      • 2018-01-09
      • 1970-01-01
      • 2018-04-09
      • 2022-08-15
      相关资源
      最近更新 更多