Missing savedAgentResultStruct | How do I get the elapsed time from saved agent?
3 次查看(过去 30 天)
显示 更早的评论
Hi,
Currently I am working on Reinforcement Learning.
I would like to display result of training curve of various training condition.
I would like to use the comparePerformance.m from the provided walking biped which save the agent in savedAgentResultstruct.
However my saved agent in saved_agent and savedAgentresult.
My question is:
- How do I convert or save properly for having saveAgentResultStruct?
- Alternatively, the needed info for comparePerformance.m is elapsed time. How do I retrieved this info from my saved agent?
Thank you in advance.
0 个评论
采纳的回答
Ari Biswas
2023-2-27
We have recently improved the design of saving agents with relevant training information. In the new design (available from R2022a), the saved agent MAT file will contain the agent (under the variable "saved_agent") and a training result object (under the variable "savedAgentResult"). The training result object replaces the previous "savedAgentResultStruct". We will fix the example to reflect the change.
The example should still work fine when comparing the existing "DDPGAgent" and "TD3Agent" folders. For new trainings, you can replace lines 76-82 in comparePerformance.m with the following code:
for i = 1:size(files,1)
S = load(files(i).name);
if isfield(S,'savedAgentResultStruct')
res = S.savedAgentResultStruct.TrainingStats;
info = S.savedAgentResultStruct.Information;
else
res = S.savedAgentResult;
info = res.Information;
end
agent.averageReward(:,i) = res.AverageReward;
agent.EpisodeQ0(:,i) = res.EpisodeQ0;
agent.EpisodeIndex = res.EpisodeIndex;
agent.ElapsedTime = info.ElapsedTime;
end
You can retrieve the elapsed time from the training result object using
t = savedAgentResult.Information.ElapsedTime
Do remember that for each new training you will need to extract the MAT-file of interest and place in a separate folder other than the auto-generated "savedAgents" folder before doing the comparison.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Training and Simulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!