public class ExponentialMovingAverage extends Object
append(double)
every time there is a new measurement, and then can collect summary
statistics from the convenience getters (e.g. getStatistics()
). Older values are given exponentially smaller
weight, with a decay factor determined by a "window" size chosen by the caller. The result is a good approximation to
the statistics of the series but with more weight given to recent measurements, so if the statistics change over time
those trends can be approximately reflected.Constructor and Description |
---|
ExponentialMovingAverage(int window)
Create a moving average accumulator with decay lapse window provided.
|
Modifier and Type | Method and Description |
---|---|
void |
append(double value)
Add a new measurement to the series.
|
int |
getCount() |
double |
getMax() |
double |
getMean() |
double |
getMin() |
double |
getStandardDeviation() |
Statistics |
getStatistics() |
void |
reset() |
String |
toString() |
public ExponentialMovingAverage(int window)
1/e
.window
- the exponential lapse window (number of measurements)public void reset()
public void append(double value)
value
- the measurement to appendpublic int getCount()
public double getMean()
public double getStandardDeviation()
public double getMax()
public double getMin()
public Statistics getStatistics()