Class ExpMovingAverage

  • All Implemented Interfaces:
    MovingAverage

    public class ExpMovingAverage
    extends java.lang.Object
    implements MovingAverage
    Sample-based exponential moving average. On every update a fraction of the current average is replaced by the new sample. New values have greater representation in the average, and older samples' effect exponentially decays with new data.
    • Method Detail

      • decayBy1000

        public static MovingAverage decayBy1000()
        Create a ExpMovingAverage where older values have less than 1% effect after 1000 samples.
      • withDecay

        public static ExpMovingAverage withDecay​(double ratio,
                                                 int samples)
        Create a ExpMovingAverage where older values have less effect than the given ratio after the given number of samples.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object