An aggregator for SummaryStatistics from several data sets or
data set partitions. In its simplest usage mode, the client creates an
instance via the zero-argument constructor, then uses
createContributingStatistics() to obtain a SummaryStatistics
for each individual data set / partition. The per-set statistics objects
are used as normal, and at any time the aggregate statistics for all the
contributors can be obtained from this object.
Clients with specialized requirements can use alternative constructors to
control the statistics implementations and initial values used by the
contributing and the internal aggregate SummaryStatistics objects.
A static aggregate(Collection) method is also included that computes
aggregate statistics directly from a Collection of SummaryStatistics instances.
When createContributingStatistics() is used to create SummaryStatistics
instances to be aggregated concurrently, the created instances'
SummaryStatistics#addValue(double) methods must synchronize on the aggregating
instance maintained by this class. In multithreaded environments, if the functionality
provided by aggregate(Collection) is adequate, that method should be used
to avoid unnecessary computation and synchronization delays.
| Modifier and Type | Class and Description |
|---|---|
| private static class | AggregateSummaryStatistics.
A SummaryStatistics that also forwards all values added to it to a second
|
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Serializable version identifier |
| private final SummaryStatistics | statistics
The SummaryStatistics in which aggregate statistics are accumulated. |
| private final SummaryStatistics | statisticsPrototype
A SummaryStatistics serving as a prototype for creating SummaryStatistics contributing to this aggregate |
| Access | Constructor and Description |
|---|---|
| public | AggregateSummaryStatistics()
Initializes a new AggregateSummaryStatistics with default statistics implementations. |
| public | AggregateSummaryStatistics(SummaryStatistics
a prototypeStatistics)SummaryStatistics serving as a
prototype both for the internal aggregate statistics and for
contributing statistics obtained via the
createContributingStatistics() method. Being a prototype
means that other objects are initialized by copying this object's state.
If null, a new, default statistics object is used. Any statistic
values in the prototype are propagated to contributing statistics
objects and (once) into these aggregate statistics.Initializes a new AggregateSummaryStatistics with the specified statistics object as a prototype for contributing statistics and for the internal aggregate statistics. |
| public | AggregateSummaryStatistics(SummaryStatistics
a prototypeStatistics, SummaryStatistics SummaryStatistics serving as a
prototype both for the internal aggregate statistics and for
contributing statistics obtained via the
createContributingStatistics() method. Being a prototype
means that other objects are initialized by copying this object's state.
If null, a new, default statistics object is used. Any statistic
values in the prototype are propagated to contributing statistics
objects, but not into these aggregate statistics.a initialStatistics)SummaryStatistics to serve as the
internal aggregate statistics object. If null, a new, default
statistics object is used.Initializes a new AggregateSummaryStatistics with the specified statistics object as a prototype for contributing statistics and for the internal aggregate statistics. |
| Modifier and Type | Method and Description |
|---|---|
| public static StatisticalSummaryValues | Returns: summary statistics for the combined datasetcollection of SummaryStatistics to aggregate statistics)Computes aggregate summary statistics. |
| public SummaryStatistics | Returns: aSummaryStatistics whose data will be aggregated with
those of this AggregateSummaryStatistics. The initial state
is a copy of the configured prototype statistics.Creates and returns a |
| public double | |
| public double | getMax()
Implements org. Returns the maximum of the available values. |
| public double | getMean()
Implements org. Returns the arithmetic mean of the available values. |
| public double | getMin()
Implements org. Returns the minimum of the available values. |
| public long | getN()
Implements org. Returns the number of available values. |
| public double | Returns: second central moment statisticReturns a statistic related to the Second Central Moment. |
| public double | getStandardDeviation()
Implements org. Returns the standard deviation of the available values.. |
| public double | getSum()
Implements org. Returns the sum of the values that have been added to Univariate.. |
| public StatisticalSummary | Returns: Current values of aggregate statisticsReturn a |
| public double | |
| public double | |
| public double | getVariance()
Implements org. Returns the variance of the available values.. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serializable version identifier | |
| statistics | back to summary |
|---|---|
| private final SummaryStatistics statistics The SummaryStatistics in which aggregate statistics are accumulated. | |
| statisticsPrototype | back to summary |
|---|---|
| private final SummaryStatistics statisticsPrototype A SummaryStatistics serving as a prototype for creating SummaryStatistics contributing to this aggregate | |
| AggregateSummaryStatistics | back to summary |
|---|---|
| public AggregateSummaryStatistics() Initializes a new AggregateSummaryStatistics with default statistics implementations. | |
| AggregateSummaryStatistics | back to summary |
|---|---|
| public AggregateSummaryStatistics(SummaryStatistics prototypeStatistics) throws NullArgumentException Initializes a new AggregateSummaryStatistics with the specified statistics object as a prototype for contributing statistics and for the internal aggregate statistics. This provides for customized statistics implementations to be used by contributing and aggregate statistics.
| |
| AggregateSummaryStatistics | back to summary |
|---|---|
| public AggregateSummaryStatistics(SummaryStatistics prototypeStatistics, SummaryStatistics initialStatistics) Initializes a new AggregateSummaryStatistics with the specified statistics object as a prototype for contributing statistics and for the internal aggregate statistics. This provides for different statistics implementations to be used by contributing and aggregate statistics and for an initial state to be supplied for the aggregate statistics.
| |
| aggregate | back to summary |
|---|---|
| public static StatisticalSummaryValues aggregate(Collection<? extends StatisticalSummary> statistics) Computes aggregate summary statistics. This method can be used to combine statistics computed over partitions or subsamples - i.e., the StatisticalSummaryValues returned should contain the same values that would have been obtained by computing a single StatisticalSummary over the combined dataset. Returns null if the collection is empty or null.
| |
| createContributingStatistics | back to summary |
|---|---|
| public SummaryStatistics createContributingStatistics() Creates and returns a
| |
| getGeometricMean | back to summary |
|---|---|
| public double getGeometricMean() Returns the geometric mean of all the aggregated data.
| |
| getMax | back to summary |
|---|---|
| public double getMax() Implements org. Doc from org. Returns the maximum of the available values. This version returns the maximum over all the aggregated data.
| |
| getMean | back to summary |
|---|---|
| public double getMean() Implements org. Doc from org. Returns the arithmetic mean of the available values. This version returns the mean of all the aggregated data.
| |
| getMin | back to summary |
|---|---|
| public double getMin() Implements org. Doc from org. Returns the minimum of the available values. This version returns the minimum over all the aggregated data.
| |
| getN | back to summary |
|---|---|
| public long getN() Implements org. Doc from org. Returns the number of available values. This version returns a count of all the aggregated data.
| |
| getSecondMoment | back to summary |
|---|---|
| public double getSecondMoment() Returns a statistic related to the Second Central Moment. Specifically, what is returned is the sum of squared deviations from the sample mean among the all of the aggregated data.
| |
| getStandardDeviation | back to summary |
|---|---|
| public double getStandardDeviation() Implements org. Doc from org. Returns the standard deviation of the available values.. This version returns the standard deviation of all the aggregated data.
| |
| getSum | back to summary |
|---|---|
| public double getSum() Implements org. Doc from org. Returns the sum of the values that have been added to Univariate.. This version returns a sum of all the aggregated data.
| |
| getSummary | back to summary |
|---|---|
| public StatisticalSummary getSummary() Return a
| |
| getSumOfLogs | back to summary |
|---|---|
| public double getSumOfLogs() Returns the sum of the logs of all the aggregated data.
| |
| getSumsq | back to summary |
|---|---|
| public double getSumsq() Returns the sum of the squares of all the aggregated data.
| |
| getVariance | back to summary |
|---|---|
| public double getVariance() Implements org. Doc from org. Returns the variance of the available values.. This version returns the variance of all the aggregated data.
| |
SummaryStatistics for aggregation.
| Modifier and Type | Field and Description |
|---|---|
| private final SummaryStatistics | aggregateStatistics
An additional SummaryStatistics into which values added to these statistics (and possibly others) are aggregated |
| private static final long | serialVersionUID
Hides org. |
| Access | Constructor and Description |
|---|---|
| pack-priv | AggregatingSummaryStatistics(SummaryStatistics
a aggregateStatistics)SummaryStatistics into which
values added to this statistics object should be aggregatedInitializes a new AggregatingSummaryStatistics with the specified aggregate statistics object |
| Modifier and Type | Method and Description |
|---|---|
| public void | addValue(double
the value to add value)Overrides org. Add a value to the data. |
| public boolean | Returns: true if object equals thisthe object to test equality against. object)Overrides org. Returns true iff |
| public int | Returns: hash codeOverrides org. Returns hash code based on values of statistics |
| aggregateStatistics | back to summary |
|---|---|
| private final SummaryStatistics aggregateStatistics An additional SummaryStatistics into which values added to these statistics (and possibly others) are aggregated | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. The serialization version of this class | |
| AggregatingSummaryStatistics | back to summary |
|---|---|
| pack-priv AggregatingSummaryStatistics(SummaryStatistics aggregateStatistics) Initializes a new AggregatingSummaryStatistics with the specified aggregate statistics object
| |
| addValue | back to summary |
|---|---|
| public void addValue(double value) Overrides org. Doc from org. Add a value to the data. This version adds the provided value to the configured aggregate after adding it to these statistics.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object object) Overrides org. Returns true iff | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides org. Returns hash code based on values of statistics
| |