org.apache.mahout.clustering
Class OnlineGaussianAccumulator
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OnlineGaussianAccumulator
public OnlineGaussianAccumulator()
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 Vectorweight
- 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.