define_episode_stats¶
-
class
maze.core.log_stats.event_decorators.
define_episode_stats
(reduce_function: Callable, input_name: Optional[str] = None, output_name: Optional[str] = None, group_by: Optional[str] = None, cumulative: bool = False)¶ Event method decorator, defines a new episode statistics calculation for this event.
- Input
all step statistics in the current episode and side-loaded episode statistics, see ‘reduce_function’ set to None
- Output
episode statistics
- Parameters
reduce_function – A function that takes a list of values and returns the calculated statistics
input_name –
The name of the step statistics, whose values are to be passed to the reduce function. Can be omitted, for which there are two reasons
no naming necessary, there is only a single step statistics available
we want all step statistics to be passed to the reduce_function as dictionaries (or our reduce function does not care, e.g. counting with len)
output_name – The name of the generated episode statistics, how it should be passed to the logger respective the following aggregation stage. Will be the same as input_name if None is provided.
group_by – If there are multiple groups defined for an event, per default the statistics is collected at the ‘cell’ level. This option allows to project the statistics onto a single group (e.g. for inventory statistics we might define location and product as groups, but prefer to monitor statistics grouped only per product, regardless of location and vice versa)
cumulative – Enable cumulative statistics
- Returns
The decorator function