Custom StopTrainingCriteria in rlTrainingOption

9 ビュー (過去 30 日間)
Muhammad Fairuz Abdul Jalal
Muhammad Fairuz Abdul Jalal 2024 年 3 月 3 日
回答済み: Avadhoot 2024 年 3 月 12 日
Hi,
In the rlTrainingOption documentation, we have
  • "Custom" — Stop training when the custom function specified in StopTrainingValue returns true.
How does it the code look like. How do we introduce function?
I would like my training to stop at average rewards of 600 and having the episodes step of 200.
Thank you in advance.

採用された回答

Avadhoot
Avadhoot 2024 年 3 月 12 日
If you want to specify a custom stopping criteria for training, you can do so by specifying a function handle in the "StopTrainingValue" parameter. Your function must have one input and one output. You can refer to the following piece of code to get a clearer idea.
StopTrainingValue = customFcn(trainingStats)
Here, "trainingStats" is a structure that contains the following fields, all described in the "trainStats" output argument of "train" function.
  • EpisodeIndex
  • EpisodeReward
  • EpisodeSteps
  • AverageReward
  • TotalAgentSteps
  • EpisodeQ0
  • SimulationInfo
  • EvaluationStatistics
  • TrainingOptions
The training stops when the specified function returns true.
You can specify the function as follows:
function y = customFcn(trainingStats)
y = (trainingStats.AverageReward == 600) && (trainingStats.EpisodeSteps == 200)
end
I have specified the conditions that you have stated in the question. You can modify the contents of the function according to your needs.
For more information on custom stopping criteria, look into the following documentation:
I hope this solves the issue.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeReinforcement Learning についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by