class maze.core.rendering.step_stats_renderer.StepStatsRenderer

Simple statistics rendering based on episode event logs.

Suitable e.g. for ad-hoc plotting of statistics for the current episode during rollout.

static render_stats(episode_event_log: maze.core.log_events.episode_event_log.EpisodeEventLog, event_name: str = 'BaseEnvEvents.reward', group_by: Optional[str] = None, aggregation_func: Optional[Callable] = None, metric: str = 'value', cumulative: bool = True)

Queries the event log for the given events, then aggregates them and plots them according to the provided options. By default, a cumulative reward is plotted.

  • episode_event_log – The episode event log to draw events from.

  • event_name – Name of the event to plot.

  • group_by – Attribute of the event that the events should be grouped by when aggregating.

  • aggregation_func – Function to aggregate the metric with.

  • metric – The metric to plot.

  • cumulative – If true, a cumulative sum of the metric is performed (after aggregation).