Class ExponentiallyWeightedMovingAverage

java.lang.Object
org.elasticsearch.common.ExponentiallyWeightedMovingAverage

public class ExponentiallyWeightedMovingAverage
extends java.lang.Object
Implements exponentially weighted moving averages (commonly abbreviated EWMA) for a single value. This class is safe to share between threads.
  • Constructor Summary

    Constructors 
    Constructor Description
    ExponentiallyWeightedMovingAverage​(double alpha, double initialAvg)
    Create a new EWMA with a given alpha and initialAvg.
  • Method Summary

    Modifier and Type Method Description
    void addValue​(double newValue)  
    double getAverage()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExponentiallyWeightedMovingAverage

      public ExponentiallyWeightedMovingAverage​(double alpha, double initialAvg)
      Create a new EWMA with a given alpha and initialAvg. 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)