question about calculate loss value of dqn agent reinforcement learning
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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?
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 comentario
Emmanouil Tzorakoleftherakis
el 27 de Jun. de 2023
Editada: Emmanouil Tzorakoleftherakis
el 27 de Jun. de 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
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!