T
- numeric type to aggregrate and create a summary, e.g. Integer, DoubleValue@Internal public abstract class NumericSummaryAggregator<T extends Number> extends Object implements Aggregator<T,NumericColumnSummary<T>>
Uses the Kahan summation algorithm to avoid numeric instability when computing variance. The algorithm is described in: "Scalable and Numerically Stable Descriptive Statistics in SystemML", Tian et al, International Conference on Data Engineering 2012
Implementation that couldn't be generic for all numbers was pushed to subclasses. For example, there isn't a generic way to calculate min, max, sum, isNan, isInfinite for all numeric types so subclasses must implement these.
Constructor and Description |
---|
NumericSummaryAggregator() |
Modifier and Type | Method and Description |
---|---|
void |
aggregate(T value)
Add a value to the current aggregation.
|
void |
combine(Aggregator<T,NumericColumnSummary<T>> otherSameType)
combine two aggregations.
|
protected abstract Aggregator<T,T> |
initMax() |
protected abstract Aggregator<T,T> |
initMin() |
protected abstract Aggregator<T,T> |
initSum() |
protected abstract boolean |
isInfinite(T number) |
protected abstract boolean |
isNan(T number) |
NumericColumnSummary<T> |
result()
Provide the final result of the aggregation.
|
public void aggregate(T value)
aggregate
in interface Aggregator<T extends Number,NumericColumnSummary<T extends Number>>
public void combine(Aggregator<T,NumericColumnSummary<T>> otherSameType)
combine
in interface Aggregator<T extends Number,NumericColumnSummary<T extends Number>>
public NumericColumnSummary<T> result()
Aggregator
result
in interface Aggregator<T extends Number,NumericColumnSummary<T extends Number>>
protected abstract Aggregator<T,T> initMin()
protected abstract Aggregator<T,T> initMax()
protected abstract Aggregator<T,T> initSum()
protected abstract boolean isNan(T number)
protected abstract boolean isInfinite(T number)
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.