## org.apache.mahout.math.stats
Class OnlineSummarizer

    java.lang.Object
      org.apache.mahout.math.stats.OnlineSummarizer

    public class OnlineSummarizer

extends Object

Computes on-line estimates of mean, variance and all five quartiles (notably including the median). Since this is done in a completely incremental fashion (that is what is meant by on-line) estimates are available at any time and the amount of memory used is constant. Somewhat surprisingly, the quantile estimates are about as good as you would get if you actually kept all of the samples.

The method used for mean and variance is Welford's method. See

http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm

The method used for computing the quartiles is a simplified form of the stochastic approximation method described in the article "Incremental Quantile Estimation for Massive Tracking" by Chen, Lambert and Pinheiro

See

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.105.1580

Constructor Summary
`OnlineSummarizer()`

Method Summary
`void` `add(double sample)`
`int` `getCount()`
`double` `getMax()`
`double` `getMean()`
`double` `getMedian()`
`double` `getMin()`
`double` `getQuartile(int i)`
`double` `getSD()`
`double` `quantile(double q)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OnlineSummarizer

    public OnlineSummarizer()

Method Detail

### add

    public void add(double sample)

### getCount

    public int getCount()

### getMean

    public double getMean()

### getSD

    public double getSD()

### getMin

    public double getMin()

### getMax

    public double getMax()

### getQuartile

    public double getQuartile(int i)

### quantile

    public double quantile(double q)

### getMedian

    public double getMedian()

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.