Class ExponentiallyWeightedMovingAverage


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

      • 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 Detail

      • getAverage

        public double getAverage()
      • addValue

        public void addValue​(double newValue)