Skip to content

schola.scripts.sb3.utils.SingleEnvRewardCallback

class schola.scripts.sb3.utils.SingleEnvRewardCallback(verbose=0, id=0, frequency=10) : Bases: BaseCallback

Callback for logging rewards and steps taken by a single environment inside a vector environment.

Parameters: : - verbose (int) – Verbosity level.

  • id (int) – The id of the environment to log rewards and steps for.
  • frequency (int) – The frequency at which to log the rewards and steps taken.

episode_reward : The reward for the current episode.

Type: : float

episode_rewards : The rewards for each episode.

Type: : List[float]

episode_steps : The number of steps taken in the current episode.

Type: : int

step_count : The number of steps taken in each episode.

Type: : List[int]

last_logging_interval : The last interval that was logged.

Type: : int

logging_interval_size : The frequency at which to log the rewards and steps taken.

Type: : int

id : The id of the environment to log rewards and steps for.

Type: : int

Methods

__init__([verbose, id, frequency])
get_reward_interval()Returns the rewards for the last logging interval.
get_step_interval()Returns the steps taken for each episode in the last logging interval.
increment_logging_interval()Increments the logging interval by self.logging_interval_size steps.
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 on sub callbacks.
update_locals(locals_)Update the references to the local variables.

Attributes

ready_to_logReturns whether the environment is ready to log, by checking if there are more episodes completed than self.logging_interval_size since we last logged.
model
logger

__init__(verbose=0, id=0, frequency=10)

get_reward_interval() : Returns the rewards for the last logging interval.

Returns: : The rewards for the last logging interval.

Return type: : List[float]

get_step_interval() : Returns the steps taken for each episode in the last logging interval.

Returns: : The steps taken for each episode in the last logging interval.

Return type: : List[int]

increment_logging_interval() : Increments the logging interval by self.logging_interval_size steps.

Return type: : None

property ready_to_log*: bool* : Returns whether the environment is ready to log, by checking if there are more episodes completed than self.logging_interval_size since we last logged.

Returns: : Whether the environment is ready to log.

Return type: : bool