lit_sb3.callbacks.trial_eval
source module lit_sb3.callbacks.trial_eval
TrialEvalCallback for Optuna hyperparameter optimisation.
Classes
-
TrialEvalCallback — Callback used for evaluating and reporting an Optuna trial.
source class TrialEvalCallback(eval_env: VecEnv, trial: Any, n_eval_episodes: int = 5, eval_freq: int = 10000, deterministic: bool = True, verbose: int = 0, best_model_save_path: str | Path | None = None, log_path: str | Path | None = None)
Bases : EvalCallback
Callback used for evaluating and reporting an Optuna trial.
Evaluates the model every eval_freq steps and reports the mean reward
to the Optuna trial. If the trial should be pruned, training is stopped
early.
Parameters
-
eval_env : VecEnv — Environment used for evaluation.
-
trial : Any — Optuna trial instance.
-
n_eval_episodes : int — Number of episodes per evaluation.
-
eval_freq : int — Evaluate every
eval_freqsteps. -
deterministic : bool — Use deterministic actions during evaluation.
-
verbose : int — Verbosity level.
-
best_model_save_path : str | Path | None — Where to save the best model.
-
log_path : str | Path | None — Where to save evaluation logs.
Attributes
-
state_key : str — Identifier for the state of the callback.