Package org.elasticsearch.common
Class ExponentiallyWeightedMovingAverage
java.lang.Object
org.elasticsearch.common.ExponentiallyWeightedMovingAverage
Implements exponentially weighted moving averages (commonly abbreviated EWMA) for a single value.
This class is safe to share between threads.
-
Constructor Summary
ConstructorDescriptionExponentiallyWeightedMovingAverage(double alpha, double initialAvg)
Create a new EWMA with a givenalpha
andinitialAvg
. -
Method Summary
-
Constructor Details
-
ExponentiallyWeightedMovingAverage
public ExponentiallyWeightedMovingAverage(double alpha, double initialAvg)Create a new EWMA with a givenalpha
andinitialAvg
. A smaller alpha means that new data points will have less weight, where a high alpha means older data points will have a lower influence.
-
-
Method Details
-
getAverage
public double getAverage() -
addValue
public void addValue(double newValue)
-