Agent in Workspace after training as the trained one?

4 views (last 30 days)
Hi, I was wondering if the Agent in the workspace is the trained one after training finished.
The point is that I have a good training result but I set the "saveAgentCriteria" to a too high value. So after the training is terminated I won't be able to simulate with the trained Agent. If I save the Agent in the workspace, I am saving the trained agent or the untrained one? Are there some other ways to save Agent without setting "saveAgentCriteria"? I am using the Reinforcement Learning Episode Manager, not the Reinforcement Learning Designer Session.
Thanks.

Answers (1)

Kartik Saxena
Kartik Saxena on 8 Jan 2024
Hi,
In MATLAB, when you are training a reinforcement learning agent using functions like `train`, the variable in the workspace that represents the agent is updated with the training progress. After the training process finishes, the agent variable in the workspace holds the trained agent, even if it hasn't met the `saveAgentCriteria`.
To explicitly save the trained agent at the end of the training or at any point during the training, you can use the `save` function in MATLAB. Here's an example of how you might do this:
[trainedAgent, trainingStats] = train(agent, env, trainingOptions);
% Save the trained agent to a MAT-file
save('trainedAgent.mat', 'trainedAgent');
For more information on training options and saving agents, you can refer to the following MathWorks documentation:
I hope this resolves your issue.
  1 Comment
taghreed mamdouh
taghreed mamdouh on 17 Jan 2024
hi Kartik Could you help me to save my trained agent taghreedmamdouh19@gmail.com

Sign in to comment.

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!