EventStatsRenderer

class maze.core.rendering.events_stats_renderer.EventStatsRenderer

Renders customizable statistics on top of event logs.

This renderer provides a central rendering functionality for event log data. Elementary customizability is offered (e.g. simple aggregation etc.). For more complex operations with the data, it is advised to work with the TSV event logs directly.

AGGREGATION_FUNCS = ['mean', 'sum', 'min', 'max', 'count']

Aggregation functions to offer to the user. Recognized as strings by pandas.

POST_PROCESSING_FUNCS = ['cumsum']

Post-processing functions to offer to the user. Recognized as strings by pandas.

close()

Close the stats figure if one has been created.

render_current_episode_stats(episode_event_log: maze.core.log_events.episode_event_log.EpisodeEventLog, event_name: str = 'BaseEnvEvents.reward', metric_name: str = 'value', aggregation_func: Optional[Union[str, Callable]] = None, group_by: str = None, post_processing_func: Optional[Union[str, Callable]] = 'cumsum')

Render event stats from episode log of currently running episode.

Creates a new figure if needed.

Parameters
  • episode_event_log – Episode event log to render events from

  • event_name – Name of the even the even log corresponds to

  • metric_name – Metric to use (one of the event attributes, e.g. “n_items” – depends on the event type)

  • aggregation_func – Optionally, specifies how to aggregate the metric on step level, i.e. when there are multiple same events dispatched during the same step.

  • group_by – Optionally, another of event attributes to group by on the step level (e.g. “product_id”)

  • post_processing_func – Optionally, a function to post-process the data (“cumsum” is often used)

static render_timeline_stat(df: pandas.DataFrame, event_name: str = 'BaseEnvEvents.reward', metric_name: str = 'value', aggregation_func: Optional[Union[str, Callable]] = None, group_by: str = None, post_processing_func: Optional[Union[str, Callable]] = 'cumsum')

Render event statistics from a data frame according to the supplied options.

Does not create a figure, renders into the currently active ax.

Parameters
  • df – Event log to render statistics from

  • event_name – Name of the even the even log corresponds to

  • metric_name – Metric to use (one of the event attributes, e.g. “n_items” – depends on the event type)

  • aggregation_func – Optionally, specifies how to aggregate the metric on step level, i.e. when there are multiple same events dispatched during the same step.

  • group_by – Optionally, another of event attributes to group by on the step level (e.g. “product_id”)

  • post_processing_func – Optionally, a function to post-process the data (“cumsum” is often used)