org.apache.mahout.cf.taste.impl.common
Class FixedRunningAverage
java.lang.Object
org.apache.mahout.cf.taste.impl.common.FixedRunningAverage
- All Implemented Interfaces:
- Serializable, RunningAverage
- Direct Known Subclasses:
- FixedRunningAverageAndStdDev
public class FixedRunningAverage
- extends Object
- implements RunningAverage, Serializable
A simple class that represents a fixed value of an average and count. This is useful
when an API needs to return RunningAverage but is not in a position to accept
updates to it.
- See Also:
- Serialized Form
FixedRunningAverage
public FixedRunningAverage(double average,
int count)
addDatum
public void addDatum(double datum)
- Specified by:
addDatum in interface RunningAverage
- Parameters:
datum - new item to add to the running average
- Throws:
UnsupportedOperationException
removeDatum
public void removeDatum(double datum)
- Specified by:
removeDatum in interface RunningAverage
- Parameters:
datum - item to remove to the running average
- Throws:
UnsupportedOperationException
changeDatum
public void changeDatum(double delta)
- Specified by:
changeDatum in interface RunningAverage
- Parameters:
delta - amount by which to change a datum in the running average
- Throws:
UnsupportedOperationException
getCount
public int getCount()
- Specified by:
getCount in interface RunningAverage
getAverage
public double getAverage()
- Specified by:
getAverage in interface RunningAverage
inverse
public RunningAverage inverse()
- Specified by:
inverse in interface RunningAverage
- Returns:
- a (possibly immutable) object whose average is the negative of this object's
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.