Skip to content

SingleEnvRewardCallback

Full path: schola.scripts.sb3.utils.SingleEnvRewardCallback

schola.scripts.sb3.utils.SingleEnvRewardCallback

SingleEnvRewardCallback

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

episode_reward

The reward for the current episode.

Type

  • float

episode_rewards

episode_rewards

The rewards for each episode.

Type

  • List[float]

episode_steps

episode_steps

The number of steps taken in the current episode.

Type

  • int

step_count

step_count

The number of steps taken in each episode.

Type

  • List[int]

last_logging_interval

last_logging_interval

The last interval that was logged.

Type

  • int

logging_interval_size

logging_interval_size

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

Type

  • int

id

id

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

Type

  • int

Methods

ItemDescription
init
get_reward_intervalReturns the rewards for the last logging interval.
get_step_intervalReturns the steps taken for each episode in the last logging interval.
increment_logging_intervalIncrements the logging interval by self.logging_interval_size steps.

Attributes

ItemDescription
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.

init

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

get_reward_interval

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

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

increment_logging_interval()

Increments the logging interval by self.logging_interval_size steps.

Returns

None


ready_to_log

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.