Missing savedAgentResultStruct | How do I get the elapsed time from saved agent?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Muhammad Fairuz Abdul Jalal
le 25 Fév 2023
Réponse apportée : Ari Biswas
le 27 Fév 2023
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 commentaires
Réponse acceptée
Ari Biswas
le 27 Fév 2023
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Training and Simulation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!