12.8.4 Comparing or Computing on Stat Values

The CompareStat provides a general way of comparing the results of different statistics with each other. Thus, one can actually use statistics to analyze one's data on-line, instead of dumping it all to a file and analyzing it after the fact.

Similarly, the ComputeStat provides a general way of performing simple math computations on the results of other stat computations. It can be used on one stat (e.g., for thresholding, absolute-value or other single-argument operations), or on two stats (e.g., for multiplying, subtracting, etc between two stats).

The compare stat contains pointers to two other stats, stat_1 and stat_2, which provide the data to compare. The data consists of any stat val data that can be found on these stats. Ideally, they both have the same number of data values, typically in their copy_vals group (e.g., from MonitorStats that are COPYing activations from two sets of units that are being compared).

The types of comparisons are simply different distance functions that measure the distances between the two stat's data:

CompareType cmp_type
This is the type of distance function to use in making the comparison:
SUM_SQUARES
sum of squares distance: sum[(x-y)^2]
EUCLIDIAN
euclidean distance: sqrt(sum[(x-y)^2])
HAMMING_DIST
hamming distance: sum[abs(x-y)]
COVAR
covariance: sum[(x-<x>)(y-<y>)]
CORREL
correlation: sum[(x-<x>)(y-<y>)] / sqrt(sum[x^2 y^2])
INNER_PROD
inner product: sum[x y]
CROSS_ENTROPY
cross entropy: sum[x ln(x/y) + (1-x)ln((1-x)/(1-y))]
float dist_tol
This is a tolerance value for distance comparisons, where absolute differences below this amount result in a 0 distance component.
bool norm
If this flag is checked, and one of the distance comparisons is being performed, the values participating in the distance computation will be normalized to a zero-one range prior to computation. If the INNER_PROD is being taken, this will result in a normalized inner-product measure (dividing by the magnitudes of the individual weight vectors).
SimpleMathSpec pre_proc_1,2,3
These allow for three steps of pre-processing on the values before they are compared. These members specify an operation and, optionally, arguements to that operation in the arg member. Note that the thresholding function THRESH compares the value to the arg, and gives a result of hi if it is greater-than-or-equal, and lo if it is less-than the arg.

The ComputeStat is like the compare stat, except that instead of computing the distance, the compute_1,2,3 math operators are applied on the stats, and the result is aggregated according to net_agg. Pre-processing of each stat independently is supported as with the compare stat. To compute something between two stats (e.g., subtract values), then you just set the compute_1 operator opr to SUB, and stat_2 values are subtracted from stat_1 values, with the result going into stat_1. Subsequent compute_ operators can then manipulate this result (e.g, doing the SQUARE). Note that they don't all have to involve both stats, and you can only use one stat (in which case compute_x just works like pre_proc_x).