schola.scripts.sb3.utils.SingleEnvRewardCallback
- class schola.scripts.sb3.utils.SingleEnvRewardCallback(verbose=0, id=0, frequency=10)[source]
-
Bases:
BaseCallback
Callback for logging rewards and steps taken by a single environment inside a vector environment.
- Parameters:
- episode_rewards
-
The rewards for each episode.
- Type:
-
List[float]
- step_count
-
The number of steps taken in each episode.
- Type:
-
List[int]
Methods
__init__
([verbose, id, frequency])Returns the rewards for the last logging interval.
Returns the steps taken for each episode in the last 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
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.
model
logger
- __init__(verbose=0, id=0, frequency=10)[source]
- get_reward_interval()[source]
-
Returns the rewards for the last logging interval.
- Returns:
-
The rewards for the last logging interval.
- Return type:
-
List[float]
- get_step_interval()[source]
-
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()[source]
-
Increments the logging interval by self.logging_interval_size steps.
- Return type:
-
None