public class AggregateSummaryStatistics extends Object implements StatisticalSummary, Serializable
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.
Constructor and Description |
---|
AggregateSummaryStatistics()
Initializes a new AggregateSummaryStatistics with default statistics
implementations.
|
AggregateSummaryStatistics(SummaryStatistics prototypeStatistics)
Initializes a new AggregateSummaryStatistics with the specified statistics
object as a prototype for contributing statistics and for the internal
aggregate statistics.
|
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.
|
Modifier and Type | Method and Description |
---|---|
static StatisticalSummaryValues |
aggregate(Collection<SummaryStatistics> statistics)
Computes aggregate summary statistics.
|
SummaryStatistics |
createContributingStatistics()
Creates and returns a
SummaryStatistics whose data will be
aggregated with those of this AggregateSummaryStatistics . |
double |
getGeometricMean()
Returns the geometric mean of all the aggregated data.
|
double |
getMax()
Returns the maximum of the available values
|
double |
getMean()
Returns the
arithmetic mean of the available values
|
double |
getMin()
Returns the minimum of the available values
|
long |
getN()
Returns the number of available values
|
double |
getSecondMoment()
Returns a statistic related to the Second Central Moment.
|
double |
getStandardDeviation()
Returns the standard deviation of the available values.
|
double |
getSum()
Returns the sum of the values that have been added to Univariate.
|
StatisticalSummary |
getSummary()
Return a
StatisticalSummaryValues instance reporting current
aggregate statistics. |
double |
getSumOfLogs()
Returns the sum of the logs of all the aggregated data.
|
double |
getSumsq()
Returns the sum of the squares of all the aggregated data.
|
double |
getVariance()
Returns the variance of the available values.
|
public AggregateSummaryStatistics()
public AggregateSummaryStatistics(SummaryStatistics prototypeStatistics)
prototypeStatistics
- a 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.NullArgumentException
- if prototypeStatistics is nullcreateContributingStatistics()
public AggregateSummaryStatistics(SummaryStatistics prototypeStatistics, SummaryStatistics initialStatistics)
prototypeStatistics
- a 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.initialStatistics
- a SummaryStatistics
to serve as the
internal aggregate statistics object. If null
, a new, default
statistics object is used.createContributingStatistics()
public double getMax()
getMax
in interface StatisticalSummary
StatisticalSummary.getMax()
public double getMean()
getMean
in interface StatisticalSummary
StatisticalSummary.getMean()
public double getMin()
getMin
in interface StatisticalSummary
StatisticalSummary.getMin()
public long getN()
getN
in interface StatisticalSummary
StatisticalSummary.getN()
public double getStandardDeviation()
getStandardDeviation
in interface StatisticalSummary
StatisticalSummary.getStandardDeviation()
public double getSum()
getSum
in interface StatisticalSummary
StatisticalSummary.getSum()
public double getVariance()
getVariance
in interface StatisticalSummary
StatisticalSummary.getVariance()
public double getSumOfLogs()
SummaryStatistics.getSumOfLogs()
public double getGeometricMean()
SummaryStatistics.getGeometricMean()
public double getSumsq()
SummaryStatistics.getSumsq()
public double getSecondMoment()
SummaryStatistics.getSecondMoment()
public StatisticalSummary getSummary()
StatisticalSummaryValues
instance reporting current
aggregate statistics.public SummaryStatistics createContributingStatistics()
SummaryStatistics
whose data will be
aggregated with those of this AggregateSummaryStatistics
.SummaryStatistics
whose data will be aggregated with
those of this AggregateSummaryStatistics
. The initial state
is a copy of the configured prototype statistics.public static StatisticalSummaryValues aggregate(Collection<SummaryStatistics> statistics)
Returns null if the collection is empty or null.
statistics
- collection of SummaryStatistics to aggregateCopyright © 2020 CNES. All rights reserved.