Warning
This package is in maintenance mode, please use Stable-Baselines3 (SB3) for an up-to-date version. You can find a migration guide in SB3 documentation.
Monitor Wrapper¶
-
class
stable_baselines.bench.monitor.
Monitor
(env: gym.core.Env, filename: Optional[str], allow_early_resets: bool = True, reset_keywords=(), info_keywords=())[source]¶ A monitor wrapper for Gym environments, it is used to know the episode reward, length, time and other data.
Parameters: - env – (gym.Env) The environment
- filename – (Optional[str]) the location to save a log file, can be None for no log
- allow_early_resets – (bool) allows the reset of the environment before it is done
- reset_keywords – (tuple) extra keywords for the reset call, if extra parameters are needed at reset
- info_keywords – (tuple) extra information to log, from the information return of environment.step
-
get_episode_lengths
() → List[int][source]¶ Returns the number of timesteps of all the episodes
Returns: ([int])
-
get_episode_rewards
() → List[float][source]¶ Returns the rewards of all the episodes
Returns: ([float])
-
get_episode_times
() → List[float][source]¶ Returns the runtime in seconds of all the episodes
Returns: ([float])
-
reset
(**kwargs) → numpy.ndarray[source]¶ Calls the Gym environment reset. Can only be called if the environment is over, or if allow_early_resets is True
Parameters: kwargs – Extra keywords saved for the next episode. only if defined by reset_keywords Returns: (np.ndarray) the first observation of the environment