lit_sb3.callbacks.stop
source module lit_sb3.callbacks.stop
Classes
-
StopTrainingOnRewardThreshold — Stop the training once a threshold in episodic reward.
-
StopTrainingOnMaxEpisodes — Stop the training once a maximum number of episodes are played.
-
StopTrainingOnNoModelImprovement — Stop the training early if there is no new best model (new best mean reward) after more than N consecutive.
source class StopTrainingOnRewardThreshold(reward_threshold: float, verbose: int = 0)
Bases : BaseCallback
Stop the training once a threshold in episodic reward.
has been reached (i.e. when the model is good enough).
It must be used with the EvalCallback.
Parameters
-
reward_threshold : float — Minimum expected reward per episode to stop training.
-
verbose : int — Verbosity level: 0 for no output, 1 for indicating when training ended because episodic reward threshold reached
Attributes
-
state_key : str — Identifier for the state of the callback.
source class StopTrainingOnMaxEpisodes(max_episodes: int, verbose: int = 0)
Bases : BaseCallback
Stop the training once a maximum number of episodes are played.
For multiple environments presumes that, the desired behavior is that the agent trains on each env for
max_episodes
and in total for max_episodes * n_envs episodes.
Parameters
-
max_episodes : int — Maximum number of episodes to stop training.
-
verbose : int — Verbosity level: 0 for no output, 1 for indicating information about when training ended by reaching
max_episodes
Attributes
-
state_key : str — Identifier for the state of the callback.
source class StopTrainingOnNoModelImprovement(max_no_improvement_evals: int, min_evals: int = 0, verbose: int = 0)
Bases : BaseCallback
Stop the training early if there is no new best model (new best mean reward) after more than N consecutive.
evaluations.
It is possible to define a minimum number of evaluations before start to count evaluations without improvement.
It must be used with the EvalCallback.
Parameters
-
max_no_improvement_evals : int — Maximum number of consecutive evaluations without a new best model.
-
min_evals : int — Number of evaluations before start to count evaluations without improvements.
-
verbose : int — Verbosity level: 0 for no output, 1 for indicating when training ended because no new best model
Attributes
-
state_key : str — Identifier for the state of the callback.