強化学習の報酬等をファイルに出力
6 views (last 30 days)
Show older comments
強化学習を行う中、
1エピソード毎に報酬やステップ数といったデータを
ファイルに出力したいのですが可能でしょうか。
trainingOptions = rlTrainingOptions(...
'MaxEpisodes',500,...
'MaxStepsPerEpisode',9490,...
'ScoreAveragingWindowLength',20,...
'Verbose',true,...
'Plots',"none",... %training-progress
'StopTrainingValue',500,...
'StopTrainingCriteria',"EpisodeCount",...
'SaveAgentValue',50,...
'SaveAgentCriteria',"EpisodeCount",...
'SaveAgentDirectory',"savedAgents");
doTraining=true;
if doTraining
trainingStats = train(agent,env,trainingOptions);
reward_per_episode=trainingStats.EpisodeReward;
steps_per_episode=trainingStats.Episodesteps;
Q0=trainingStats.EpisodeQ0;
dlmwrite(strcat(path,'results\reward.csv'),reward_per_episode,'-append');
dlmwrite(strcat(path,'results\steps.csv'),steps_per_episode,'-append');
dlmwrite(strcat(path,'results\Q0.csv'),Q0,'-append');
現在上記のようなコードを書いているのですが、
このままだと500エピソード目の結果しか出力されないようです。
0 Comments
Answers (0)
See Also
Categories
Find more on Training and Simulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!