define_epoch_stats¶
-
class
maze.core.log_stats.event_decorators.
define_epoch_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 epoch statistics calculation for this event.
- Input
All episode statistics of the current epoch and side-loaded epoch statistics, see ‘reduce_function’ set to None
- Output
Epoch statistics
- Parameters
reduce_function – A function that takes a list of values and returns the calculated statistics
input_name –
The name of the event attribute (=keyword attribute), 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 epoch statistics available
we want all episode 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 epoch 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