commonpower.control.logging_utils.callbacks.SafetyCallback

class SafetyCallback(verbose: int = 0)[source]

Bases: BaseCallback

Class for logging additional safety information for single-agent stable-baselines3 algorithms

Methods

init_callback

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

update_child_locals

Update the references to the local variables on sub callbacks.

update_locals

Update the references to the local variables.

Attributes

model

logger

_on_rollout_end() None[source]

At the end of one training episode, we want to log some information about the safety shield.

Returns:

None

_on_step() bool[source]
Returns:

If the callback returns False, training is aborted early.