question about calculate loss value of dqn agent reinforcement learning
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hello everyone,
I want to plot curve of loss value during training. It is not available in dqn training option directly as i know. My question is :
can i calculate loss simply with this function?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1419183/image.png)
Q0 is predicted value by critic. (orange line in default process-training plot)
EpisodeReward is gained reward by agent in t episode
t is number of episode
%% example code for loss plotting here
% unpack training statistic
index = trainingStats.EpisodeIndex;
reward = trainingStats.EpisodeReward;
pred_reward = trainingStats.EpisodeQ0;
Loss_Plot = [];
for t = 1:size(index, 1)
loss = (sum(pred_reward(1:t, 1)) - sum(reward(1:t, 1)))/t
Loss = [t, loss];
Loss_Plot = [Loss_Plot; Loss]
end
% plot curve
plot(Loss_Plot(:, 1), Loss_Plot(:, 2), '-')
can i plot loss value of episode with this example code properly?
thanks in advance.
Kun
1 commentaire
Emmanouil Tzorakoleftherakis
le 27 Juin 2023
Modifié(e) : Emmanouil Tzorakoleftherakis
le 27 Juin 2023
Which version are you using? You can log loss data following the guidelines here: https://www.mathworks.com/help/reinforcement-learning/ug/log-training-data-to-disk.html
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!