RLlib Callbacks
bsk_rl.utils.rllib.callbacks is a collection of utilities for logging additional data in RLlib.
- class EpisodeDataLogger(episode_data_callback=None, satellite_data_callback=None)[source]
Bases:
objectInitialize the episode data logger.
- class EpisodeDataWrapper(env: Env, episode_data_callback: Callable[[GeneralSatelliteTasking], dict[str, float]] | None = None, satellite_data_callback: Callable[[GeneralSatelliteTasking, Satellite], dict[str, float]] | None = None)[source]
Bases:
EpisodeDataLogger,WrapperWrapper for logging data at the end of each multiagent episode.
This wrapper should be used with the
WrappedEpisodeDataCallbacksin RLlib. At the end of each episode, the environment will log data using the provided callback functions. See Training with RLlib PPO for an example of how to use this class.- Parameters:
env (Env) – The environment to wrap.
episode_data_callback (Callable[[GeneralSatelliteTasking], dict[str, float]] | None) – A function that takes the environment as an argument and returns a dictionary of episode-level metrics.
satellite_data_callback (Callable[[GeneralSatelliteTasking, Satellite], dict[str, float]] | None) – A function that takes the environment and a satellite as arguments and returns a dictionary of satellite-level metrics.
- class EpisodeDataParallelWrapper(env: ParallelEnv, episode_data_callback: Callable[[GeneralSatelliteTasking], dict[str, float]] | None = None, satellite_data_callback: Callable[[GeneralSatelliteTasking, Satellite], dict[str, float]] | None = None)[source]
Bases:
EpisodeDataLogger,BaseParallelWrapperWrapper for logging data at the end of each multiagent episode.
This wrapper should be used with the
WrappedEpisodeDataCallbacksin RLlib. At the end of each episode, the environment will log data using the provided callback functions. See Asynchronous Multiagent Decision Making for an example of how to use this class.- Parameters:
env (ParallelEnv) – The environment to wrap.
episode_data_callback (Callable[[GeneralSatelliteTasking], dict[str, float]] | None) – A function that takes the environment as an argument and returns a dictionary of episode-level metrics.
satellite_data_callback (Callable[[GeneralSatelliteTasking, Satellite], dict[str, float]] | None) – A function that takes the environment and a satellite as arguments and returns a dictionary of satellite-level metrics.
- class WrappedEpisodeDataCallbacks(*args, **kwargs)[source]
Bases:
DefaultCallbacksLog information at the end of each episode.
Logs data from an environment wrapped with
EpisodeDataWrapperorEpisodeDataParallelWrapper. See Training with RLlib PPO for an example of how to use this class.