public class StreamingStatistics extends Object implements StatisticalSummary, AggregatableStatistic<StreamingStatistics>, DoubleConsumer, Serializable
addValue method. The data values are not stored in
 memory, so this class can be used to compute statistics for very large data
 streams.
 
 By default, all statistics other than percentiles are maintained.  Percentile
 calculations use an embedded RandomPercentile which carries more memory
 and compute overhead than the other statistics, so it is disabled by default.
 To enable percentiles, either pass true to the constructor or use a
 StreamingStatistics.StreamingStatisticsBuilder to configure an instance with percentiles turned
 on. Other stats can also be selectively disabled using
 StreamingStatisticsBulder.
 
Note: This class is not thread-safe.
| Modifier and Type | Class and Description | 
|---|---|
| static class  | StreamingStatistics.StreamingStatisticsBuilderBuilder for StreamingStatistics instances. | 
| Constructor and Description | 
|---|
| StreamingStatistics()Construct a new StreamingStatistics instance, maintaining all statistics
 other than percentiles. | 
| StreamingStatistics(boolean computePercentiles)Construct a new StreamingStatistics instance, maintaining all statistics
 other than percentiles and with/without percentiles per the argument. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | accept(double value) | 
| void | addValue(double value)Add a value to the data | 
| void | aggregate(StreamingStatistics other)Aggregates the provided instance into this instance. | 
| static StreamingStatistics.StreamingStatisticsBuilder | builder()Returns a  StreamingStatistics.StreamingStatisticsBuilderto source configuredStreamingStatisticsinstances. | 
| void | clear()Resets all statistics and storage. | 
| StreamingStatistics | copy()Returns a copy of this StreamingStatistics instance with the same internal state. | 
| boolean | equals(Object object)Returns true iff  objectis aStreamingStatisticsinstance and all statistics have the same values as this. | 
| double | getGeometricMean()Returns the geometric mean of the values that have been added. | 
| double | getMax()Returns the maximum of the available values | 
| double | getMean()Returns the 
 arithmetic mean  of the available values | 
| double | getMedian()Returns an estimate of the median of the values that have been entered. | 
| double | getMin()Returns the minimum of the available values | 
| long | getN()Returns the number of available values | 
| double | getPercentile(double percentile)Returns an estimate of the given percentile of the values that have been entered. | 
| double | getPopulationVariance()Returns the 
 population variance of the values that have been added. | 
| double | getQuadraticMean()Returns the quadratic mean, a.k.a. | 
| double | getSecondMoment()Returns a statistic related to the Second Central Moment. | 
| double | getStandardDeviation()Returns the standard deviation of the values that have been added. | 
| double | getSum()Returns the sum of the values that have been added to Univariate. | 
| StatisticalSummary | getSummary()Return a  StatisticalSummaryValuesinstance reporting current
 statistics. | 
| double | getSumOfLogs()Returns the sum of the logs of the values that have been added. | 
| double | getSumOfSquares()Returns the sum of the squares of the values that have been added. | 
| double | getVariance()Returns the variance of the available values. | 
| int | hashCode()Returns hash code based on values of statistics. | 
| String | toString()Generates a text report displaying summary statistics from values that
 have been added. | 
clone, finalize, getClass, notify, notifyAll, wait, wait, waitaggregate, aggregateaggregate, aggregateandThenpublic StreamingStatistics()
public StreamingStatistics(boolean computePercentiles)
computePercentiles - whether or not percentiles are maintainedpublic StreamingStatistics copy()
public StatisticalSummary getSummary()
StatisticalSummaryValues instance reporting current
 statistics.public void addValue(double value)
value - the value to addpublic void accept(double value)
accept in interface DoubleConsumerpublic void clear()
public long getN()
getN in interface StatisticalSummarypublic double getMax()
getMax in interface StatisticalSummarypublic double getMin()
getMin in interface StatisticalSummarypublic double getSum()
getSum in interface StatisticalSummarypublic double getSumOfSquares()
Double.NaN is returned if no values have been added.
public double getMean()
getMean in interface StatisticalSummarypublic double getVariance()
getVariance in interface StatisticalSummarypublic double getPopulationVariance()
Double.NaN is returned if no values have been added.
public double getGeometricMean()
Double.NaN is returned if no values have been added.
public double getSumOfLogs()
Double.NaN is returned if no values have been added.
public double getSecondMoment()
 Returns Double.NaN if no data values have been added and
 returns 0 if there is just one value in the data set.
public double getQuadraticMean()
Double.NaN if no values
 have been added.public double getStandardDeviation()
Double.NaN is returned if no values have been added.
getStandardDeviation in interface StatisticalSummarypublic double getMedian()
RandomPercentile for a description of the algorithm used for large
 data streams.public double getPercentile(double percentile)
RandomPercentile for a description of the algorithm used for large
 data streams.percentile - the desired percentile (must be between 0 and 100)public void aggregate(StreamingStatistics other)
This method can be used to combine statistics computed over partitions or subsamples - i.e., the value of this instance after this operation should be the same as if a single statistic would have been applied over the combined dataset. Statistics are aggregated only when both this and other are maintaining them. For example, if this.computeMoments is false, but other.computeMoments is true, the moment data in other will be lost.
aggregate in interface AggregatableStatistic<StreamingStatistics>other - the instance to aggregate into this instancepublic String toString()
public boolean equals(Object object)
object is a StreamingStatistics
 instance and all statistics have the same values as this.public int hashCode()
public static StreamingStatistics.StreamingStatisticsBuilder builder()
StreamingStatistics.StreamingStatisticsBuilder to source configured
 StreamingStatistics instances.Copyright © 2016–2020 Hipparchus.org. All rights reserved.