I am training the network, but the progress is not shown in the plot. However, the variables during the reward function calculation are displayed on the screen as shown in the figure below.
doTraining = true;
if doTraining
% Train the agent.
trainingStats = train(agent,env,trainOpts);
else
% Load the pretrained agent for the example.
load("PretrainedDDPGAgent.mat","agent")
end

 Akzeptierte Antwort

Gojo
Gojo am 18 Sep. 2024
Bearbeitet: Gojo am 18 Sep. 2024

0 Stimmen

Hey Sania,
For plotting the training progress, you can use the "Plots" Name-Value arguments while providing the training options to train the network. For example:
trainOpts = rlTrainingOptions(...
MaxEpisodes=1000,...
MaxStepsPerEpisode=1000,...
StopTrainingCriteria="AverageReward",...
StopTrainingValue=480,...
Verbose=true,...
Plots="training-progress")
You can refer to the following documentation for more information on the arguments:
I hope this helps!

4 Kommentare

Sania Gul
Sania Gul am 19 Sep. 2024
Bearbeitet: Sania Gul am 19 Sep. 2024
Tnks Shubham, now graph is plotted in the training monitor window. But still only the Episode Q0 is plotted. No episode or average reward is visible as shown in pic attached. My training options are
dotraining = true;
trainOpts = rlTrainingOptions(...
MaxEpisodes = 150, ...
MaxStepsPerEpisode = maxStepsPerEpisode, ...
ScoreAveragingWindowLength = 5,...
Verbose = true, ...
Plots = "training-progress",...
StopTrainingCriteria = "AverageReward",...
StopTrainingValue = 2)
Please tell me how I can save the trained model. I shall be very thankful to you.
Gojo
Gojo am 19 Sep. 2024
Bearbeitet: Gojo am 19 Sep. 2024
For episode and average reward, could you share the relevant files so that I can reproduce the issue?
In order to save the trained agent, you can either use training options or use the "save" function: https://www.mathworks.com/help/reinforcement-learning/ug/train-reinforcement-learning-agents.html#mw_0727b1a5-1162-4517-ae6d-bdb00ef7d5db
Sania Gul
Sania Gul am 19 Sep. 2024
Bearbeitet: Sania Gul am 19 Sep. 2024
Tnk u soooooooooo mch for this coperation. I have increased the value of StopTrainingValue and now all 3 curves(dark, light blue and orange) are visible.
Gojo
Gojo am 19 Sep. 2024
Bearbeitet: Gojo am 19 Sep. 2024
Glad the issue is resolved!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Gefragt:

am 18 Sep. 2024

Bearbeitet:

am 19 Sep. 2024

Community Treasure Hunt

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

Start Hunting!

Translated by