Class EWMA

java.lang.Object
org.apache.pekko.cluster.metrics.EWMA
All Implemented Interfaces:
Serializable, scala.Equals, scala.Product

public final class EWMA extends Object implements scala.Product, Serializable
The exponentially weighted moving average (EWMA) approach captures short-term movements in volatility for a conditional volatility forecasting model. By virtue of its alpha, or decay factor, this provides a statistical streaming data model that is exponentially biased towards newer entries.

https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average

An EWMA only needs the most recent forecast value to be kept, as opposed to a standard moving average model.

param: alpha decay factor, sets how quickly the exponential weighting decays for past data compared to new data, see https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average

param: value the current exponentially weighted moving average, e.g. Y(n - 1), or, the sampled value resulting from the previous smoothing iteration. This value is always used as the previous EWMA to calculate the new EWMA.

See Also:
  • Constructor Details

    • EWMA

      public EWMA(double value, double alpha)
  • Method Details

    • apply

      public static EWMA apply(double value, double alpha)
    • unapply

      public static scala.Option<scala.Tuple2<Object,Object>> unapply(EWMA x$0)
    • value

      public double value()
    • alpha

      public double alpha()
    • $colon$plus

      public EWMA $colon$plus(double xn)
      Calculates the exponentially weighted moving average for a given monitored data set.

      Parameters:
      xn - the new data point
      Returns:
      a new EWMA with the updated value
    • copy

      public EWMA copy(double value, double alpha)
    • copy$default$1

      public double copy$default$1()
    • copy$default$2

      public double copy$default$2()
    • productPrefix

      public String productPrefix()
      Specified by:
      productPrefix in interface scala.Product
    • productArity

      public int productArity()
      Specified by:
      productArity in interface scala.Product
    • productElement

      public Object productElement(int x$1)
      Specified by:
      productElement in interface scala.Product
    • productIterator

      public scala.collection.Iterator<Object> productIterator()
      Specified by:
      productIterator in interface scala.Product
    • canEqual

      public boolean canEqual(Object x$1)
      Specified by:
      canEqual in interface scala.Equals
    • productElementName

      public String productElementName(int x$1)
      Specified by:
      productElementName in interface scala.Product
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object x$1)
      Specified by:
      equals in interface scala.Equals
      Overrides:
      equals in class Object