12.7.1 Aggregation Operators and other Parameters

For both the time_agg and the net_agg members of a stat, the following aggregation operators are defined:

LAST
This simply copies the last value seen. This is useful for aggregators that appear in the train and batch levels of processing, which typically just reflect the results of the most recent epoch of processing. In the network-level aggregation, this would give the value of the last unit, which is not terribly useful.
SUM
This sums over all values.
PROD
This gives a product over all values. When this operator is used, the result variable will be initialized to 1.
MIN
This gives the minimum value of all seen. Note that when this is the aggregation operator, the result variable will be initialized to a very large number.
MAX
This gives the maximum value of all seen. Note that when this is the aggregation operator, the result variable will be initialized to a very small number.
AVG
This gives the average of all values seen. Since aggregation happens on-line, we use the on-line version of averaging, so the result is always the average of what has been seen so far.
COPY
This results in the collection of individual values, which are kept in the copy_vals group of the stat. Thus, it does not form a single summary number of all the values, instead it simply copies them verbatim. This is useful for MonitorStat objects, which copy state variables from the network. It can be used to view per-event values at the end of the epoch by doing a time_agg with the COPY operator.
COUNT
This counts up the the number of times the values meet the comparison expression given in the count field of the agg member. The count expression has relational operators and a comparison value, so one could for example count the number of times an error value was below some threshold.

In addition to the aggregation operator, the time_agg member has a pointer to the stat that this stat is aggregating from. If this is NULL, then the stat is computing original information instead of aggregating.

It is possible to control when the stat is computed, and if the data is logged, independently. The mod member of a stat determines when and if it is computed (and when its criterion is checked, when it is logged, etc). For stats located in the loop_stats group, this mod operator works on the process whose loop_stats the stat is in. For stats located in the final_stats group, the mod operator works on the next higher up process in the hierarchy (i.e., a stat in the final_stats of a TrialProcess would use the trial counter from the parent EpochProcess). The log_stat flag provides a way of turning on or off the logging of a statistic. If the flag is not checked, a stat is not logged, but it is run and its criterion is checked (as per the mod settings). Thus, one can keep lower-level stats which might be just collecting data for aggregation from generating too much log data.

Finally, the computation of the stat over the objects in the network can be restricted to a given layer by setting the layer pointer. The layer name will also appear in the stat log output and in the name field of the stat itself.