org.apache.mahout.cf.taste.impl.common
Class FullRunningAverageAndStdDev

java.lang.Object
  extended by org.apache.mahout.cf.taste.impl.common.FullRunningAverage
      extended by org.apache.mahout.cf.taste.impl.common.FullRunningAverageAndStdDev
All Implemented Interfaces:
Serializable, RunningAverage, RunningAverageAndStdDev

public final class FullRunningAverageAndStdDev
extends FullRunningAverage
implements RunningAverageAndStdDev

Extends FullRunningAverage to add a running standard deviation computation. Uses Welford's method, as described at http://www.johndcook.com/standard_deviation.html

See Also:
Serialized Form

Constructor Summary
FullRunningAverageAndStdDev()
           
FullRunningAverageAndStdDev(int count, double average, double mk, double sk)
           
 
Method Summary
 void addDatum(double datum)
           
 void changeDatum(double delta)
           
 double getMk()
           
 double getSk()
           
 double getStandardDeviation()
           
 RunningAverageAndStdDev inverse()
           
 void removeDatum(double datum)
           
 String toString()
           
 
Methods inherited from class org.apache.mahout.cf.taste.impl.common.FullRunningAverage
getAverage, getCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.mahout.cf.taste.impl.common.RunningAverage
getAverage, getCount
 

Constructor Detail

FullRunningAverageAndStdDev

public FullRunningAverageAndStdDev()

FullRunningAverageAndStdDev

public FullRunningAverageAndStdDev(int count,
                                   double average,
                                   double mk,
                                   double sk)
Method Detail

getMk

public double getMk()

getSk

public double getSk()

getStandardDeviation

public double getStandardDeviation()
Specified by:
getStandardDeviation in interface RunningAverageAndStdDev
Returns:
standard deviation of data

addDatum

public void addDatum(double datum)
Specified by:
addDatum in interface RunningAverage
Overrides:
addDatum in class FullRunningAverage
Parameters:
datum - new item to add to the running average

removeDatum

public void removeDatum(double datum)
Specified by:
removeDatum in interface RunningAverage
Overrides:
removeDatum in class FullRunningAverage
Parameters:
datum - item to remove to the running average

changeDatum

public void changeDatum(double delta)
Specified by:
changeDatum in interface RunningAverage
Overrides:
changeDatum in class FullRunningAverage
Parameters:
delta - amount by which to change a datum in the running average
Throws:
UnsupportedOperationException

inverse

public RunningAverageAndStdDev inverse()
Specified by:
inverse in interface RunningAverage
Specified by:
inverse in interface RunningAverageAndStdDev
Overrides:
inverse in class FullRunningAverage
Returns:
a (possibly immutable) object whose average is the negative of this object's

toString

public String toString()
Overrides:
toString in class FullRunningAverage


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