machine-learning - 深度强化学习训练准确率

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

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

enter image description here

从该图中可以看出,验证和测试精度都是随机的,因此,代理当然会过度拟合。

但更让我惊讶的是(也许是因为缺乏知识,所以我才来这里问你),是我的同事如何培训他的经纪人。在此图表的 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 - 深度强化学习训练准确率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56446182/

相关文章:

r - 为什么会出现Fmodel错误?如何使用Fmodel函数?

Python:DeprecationWarning:elementwise == 比较失败;这将在未来引发错误

python - tensorflow如何处理二维误差

python - 如何使用 object_detector.EfficientDetLite4Spec tensorflow lite 继续训练检查点

neural-network - 使用神经网络进行 Q 学习

machine-learning - 为什么自然语言处理中的 Transformer 需要一堆编码器?

新生神经网络的项目主题?

python - TensorFlow:为什么在从 TFRecord 文件解析 TF 示例时需要 reshape 非稀疏元素一次?

algorithm - 人工智能在语义网中的应用

machine-learning - 如何使用 scikit-learn 和 matplotlib 绘制不平衡数据集的 SVC 分类?