springs.util
Class IncrementalAverageComputator
java.lang.Object
|
+--springs.util.IncrementalAverageComputator
- public class IncrementalAverageComputator
- extends java.lang.Object
Note: inspired by:
http://www.cs.ualberta.ca/~sutton/book/ebook/node19.html
Chapter 2.5 "Incremental Implementation" of:
"Reinforcement Learning: An Introduction"
by: Richard S. Sutton and Andrew G. Barto
A Bradford Book
The MIT Press
Cambridge, Massachusetts
London, England
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_numSamples
private long _numSamples
_averageSoFar
private double _averageSoFar
_totalAccumulatedValue
private double _totalAccumulatedValue
IncrementalAverageComputator
public IncrementalAverageComputator()
addSample
public void addSample(double sample)
- Adds a sample to the average.
- Parameters:
sample
- the sample.
getAverage
public double getAverage()
- Gets the average so far.
- Returns:
- the average.
getTotalAccumulatedValue
public double getTotalAccumulatedValue()
- Gets the total accumulated value.
- Returns:
- the total accumulated value.