Stat Collectors

Statistics collectors are defined by implementing the StatCollector<T, U> interface. The <T> is the type of data that statistics are being collected upon, and the <U> is the type of data used in the resulting data points generated by the stat collector.

Like filters, stat collectors are associated with a single field of the candidate objects by field name. Stat collectors are fed field values from every candidate, regardless of whether or not they match any filters. Once all candidates have been processed, the stat collector compute() method is called. The compute method should finalize the statistics (it is within this method where the list of data points should generally be created). Finally, a stat collector provides methods getStatistics(), which returns a list of data point objects, and formatStatistic(...) that should format a single data point as a String.

The getStatistics() method can return any number of data point objects, each of which must implement the DataPoint interface. Each data point has a value, and optionally, a label for each value. The value type is defined by the <U> generic parameter on the stat collector.

XanderCat OFE 1.2 provides the following stat collectors:
Stat Collector Description
AverageStatCollector Calculates the average value for a numeric field.
CountDistinctStatCollector Counts how many times it encounters each distinct variation of field value.
MatchCountStatCollector Counts how many times a field value matches a given filter.
MedianStatCollector Calculates the median value for a numeric field.
MinMaxStatCollector Tracks the minimum and maximum values for a numeric field.


Stat Collectors will be provided in the final release of XanderCat OFE version 1.2; they are not available in version 1.1

Last edited Mar 16, 2016 at 6:30 PM by scottcarnold, version 3