Class EMA


  • public class EMA
    extends java.lang.Object
    Exponential moving average: EMA(v) = v*(1-k)+ previousEMA*k, where k = e^(-timeSincePreviousMeasurement/decayTime)
    • Constructor Summary

      Constructors 
      Constructor Description
      EMA​(double decayTimeMillis)
      Creates a running EMA instance
    • Constructor Detail

      • EMA

        public EMA​(double decayTimeMillis)
        Creates a running EMA instance
        Parameters:
        decayTimeMillis - Time in milliseconds during which a reading's weight falls to 1/e.
    • Method Detail

      • update

        public double update​(double value)
      • clear

        public void clear()
      • getLastRegisteredValue

        public double getLastRegisteredValue()
      • getAverage

        public double getAverage()
      • register

        public void register​(double value)
      • register

        public void register​(double value,
                             long time)