sinergym.utils.callbacks.LoggerEvalCallback

class sinergym.utils.callbacks.LoggerEvalCallback(eval_env: Union[gym.core.Env, stable_baselines3.common.vec_env.base_vec_env.VecEnv], callback_on_new_best: Optional[stable_baselines3.common.callbacks.BaseCallback] = None, n_eval_episodes: int = 5, eval_freq: int = 10000, log_path: Optional[str] = None, best_model_save_path: Optional[str] = None, deterministic: bool = True, render: bool = False, verbose: int = 1, warn: bool = True)

Callback for evaluating an agent. :param eval_env: The environment used for initialization :param callback_on_new_best: Callback to trigger when there is a new best model according to the mean_reward :param n_eval_episodes: The number of episodes to test the agent :param eval_freq: Evaluate the agent every eval_freq call of the callback. :param log_path: Path to a folder where the evaluations (evaluations.npz) will be saved. It will be updated at each evaluation. :param best_model_save_path: Path to a folder where the best model according to performance on the eval env will be saved. :param deterministic: Whether the evaluation should use a stochastic or deterministic actions. :param render: Whether to render or not the environment during evaluation :param verbose: :param warn: Passed to evaluate_policy (warns if eval_env has not been wrapped with a Monitor wrapper)

__init__(eval_env: Union[gym.core.Env, stable_baselines3.common.vec_env.base_vec_env.VecEnv], callback_on_new_best: Optional[stable_baselines3.common.callbacks.BaseCallback] = None, n_eval_episodes: int = 5, eval_freq: int = 10000, log_path: Optional[str] = None, best_model_save_path: Optional[str] = None, deterministic: bool = True, render: bool = False, verbose: int = 1, warn: bool = True)

Methods

__init__(eval_env[, callback_on_new_best, ...])

init_callback(model)

Initialize the callback by saving references to the RL model and the training environment for convenience.

on_rollout_end()

on_rollout_start()

on_step()

This method will be called by the model after each call to env.step().

on_training_end()

on_training_start(locals_, globals_)

update_child_locals(locals_)

Update the references to the local variables.

update_locals(locals_)

Update the references to the local variables.