簡體   English   中英

深度強化學習訓練准確性

[英]Deep Reinforcement Learning Training Accuracy

我正在使用深度強化學習方法來預測時間序列行為。 我是一個相當新手,所以我的問題比計算機編程更具概念性。 我的同事給了我以下圖表,其中包括使用深度強化學習的時間序列數據分類的培訓,驗證和測試准確性。

在此輸入圖像描述

從該圖中,可以看出驗證和測試精度都是隨機的,因此,當然,代理程序過度擬合。

但是讓我更驚訝的是(可能是因為缺乏知識,這就是我在這里問你的原因),我的同事是如何訓練他的經紀人的。 在此圖表的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()

根據圖表和代碼對我來說很奇怪的是,代理人多次相互安裝,但訓練准確性隨着時間而增加。 似乎以前的經驗正在幫助代理人提高培訓的准確性。 但是,如果重置環境並且代理只是再次安裝,那怎么可能呢? 以前的配件是否有任何反向傳播錯誤,這有助於代理商提高下一個配件的准確性?

重置的是環境,而不是代理。 因此,代理實際上積累了每次迭代的經驗。

環境正在重置,但不是代理。

可學習的參數屬於代理,而不屬於環境。 因此,代理的參數在所有劇集中都在變化,即代理在每次適合數據時都在學習。

如果數據在您適合的所有時間都相同,那么它只會使我們的代理人過度擬合數據分布

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM