LogStatsEnv¶
- class maze.core.log_stats.log_stats_env.LogStatsEnv¶
Interface to access logging statistics generated by the environment. Most envs won’t implement this directly, but use the LogStatsWrapper to implement this functionality.
- abstract clear_epoch_stats() None¶
- Use this to clear episode statistics collected so far in this epoch (i.e., inputs for epoch stats),
and start fresh.
This can be useful for clearing left-over statistics. E.g., in later epochs, there might be an environment left in the middle of an unfinished episode, which should not be counted into the current epoch.
- abstract get_stats(level: LogStatsLevel) LogStatsAggregator¶
Get access to the statistics aggregator, which can be used to receive the latest statistics dictionary (via
last_stats()) or to register log consumers.- Parameters:
level – The statistics aggregation level (LogStatsLevel.STEP, LogStatsLevel.EPISODE or LogStatsLevel.EPOCH)
- Returns:
The statistics aggregator
- abstract get_stats_value(event: Callable, level: LogStatsLevel, name: str | None = None) int | float | numpy.ndarray | dict¶
Obtain a single value from the statistics dict.
- Parameters:
event – The event interface method of the value in question
level – The statistics aggregation level (LogStatsLevel.STEP, LogStatsLevel.EPISODE or LogStatsLevel.EPOCH)
name – The output_name of the statistics in case it has been specified in
maze.core.log_stats.event_decorators.define_epoch_stats()
- Returns:
The statistics dictionary
- abstract write_epoch_stats() None¶
Use this if you do not want to wait for the next
maze.core.log_stats.log_stats.increment_log_step()call to update the epoch statistics.This can be useful in a training scenario to get the results of the evaluation rollouts immediately, instead of waiting for the next log step increment to occur.