org.apache.mahout.clustering
Class OnlineGaussianAccumulator

java.lang.Object
  extended by org.apache.mahout.clustering.OnlineGaussianAccumulator
All Implemented Interfaces:
GaussianAccumulator

public class OnlineGaussianAccumulator
extends Object
implements GaussianAccumulator

An online Gaussian statistics accumulator based upon Knuth (who cites Welford) which is declared to be numerically-stable. See http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance


Constructor Summary
OnlineGaussianAccumulator()
           
 
Method Summary
 void compute()
          Compute the mean, variance and standard deviation
 double getAverageStd()
           
 Vector getMean()
           
 double getN()
           
 Vector getStd()
           
 Vector getVariance()
           
 void observe(Vector x, double weight)
          Observe the vector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OnlineGaussianAccumulator

public OnlineGaussianAccumulator()
Method Detail

getN

public double getN()
Specified by:
getN in interface GaussianAccumulator
Returns:
the number of observations

getMean

public Vector getMean()
Specified by:
getMean in interface GaussianAccumulator
Returns:
the mean of the observations

getStd

public Vector getStd()
Specified by:
getStd in interface GaussianAccumulator
Returns:
the std of the observations

observe

public void observe(Vector x,
                    double weight)
Description copied from interface: GaussianAccumulator
Observe the vector

Specified by:
observe in interface GaussianAccumulator
Parameters:
x - a Vector
weight - the double observation weight (usually 1.0)

compute

public void compute()
Description copied from interface: GaussianAccumulator
Compute the mean, variance and standard deviation

Specified by:
compute in interface GaussianAccumulator

getAverageStd

public double getAverageStd()
Specified by:
getAverageStd in interface GaussianAccumulator
Returns:
the average of the vector std elements

getVariance

public Vector getVariance()
Specified by:
getVariance in interface GaussianAccumulator
Returns:
the variance of the observations


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