question about calculate loss value of dqn agent reinforcement learning

2 次查看(过去 30 天)
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

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by