Class MovAvgModel

java.lang.Object
org.elasticsearch.search.aggregations.pipeline.MovAvgModel
All Implemented Interfaces:
NamedWriteable, Writeable, ToXContent, ToXContentFragment
Direct Known Subclasses:
EwmaModel, HoltLinearModel, HoltWintersModel, LinearModel, SimpleModel

public abstract class MovAvgModel
extends java.lang.Object
implements NamedWriteable, ToXContentFragment
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  MovAvgModel.AbstractModelParser
    Abstract class which also provides some concrete parsing functionality.

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors 
    Constructor Description
    MovAvgModel()  
  • Method Summary

    Modifier and Type Method Description
    abstract boolean canBeMinimized()
    Returns if the model can be cost minimized.
    abstract MovAvgModel clone()
    Clone the model, returning an exact copy
    protected abstract double[] doPredict​(java.util.Collection<java.lang.Double> values, int numPredictions)
    Calls to the model-specific implementation which actually generates the predictions
    protected double[] emptyPredictions​(int numPredictions)
    Returns an empty set of predictions, filled with NaNs
    abstract boolean equals​(java.lang.Object obj)  
    abstract int hashCode()  
    boolean hasValue​(int valuesAvailable)
    Checks to see this model can produce a new value, without actually running the algo.
    boolean minimizeByDefault()
    Should this model be fit to the data via a cost minimizing algorithm by default?
    abstract MovAvgModel neighboringModel()
    Generates a "neighboring" model, where one of the tunable parameters has been randomly mutated within the allowed range.
    abstract double next​(java.util.Collection<java.lang.Double> values)
    Returns the next value in the series, according to the underlying smoothing model
    double[] predict​(java.util.Collection<java.lang.Double> values, int numPredictions)
    Predicts the next `n` values in the series.
    protected void validate​(long window, java.lang.String aggregationName)
    This method allows models to validate the window size if required
    abstract void writeTo​(StreamOutput out)
    Write the model to the output stream

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.elasticsearch.common.io.stream.NamedWriteable

    getWriteableName

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContent

    toXContent

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment

    isFragment
  • Constructor Details

  • Method Details

    • minimizeByDefault

      public boolean minimizeByDefault()
      Should this model be fit to the data via a cost minimizing algorithm by default?
    • canBeMinimized

      public abstract boolean canBeMinimized()
      Returns if the model can be cost minimized. Not all models have parameters which can be tuned / optimized.
    • neighboringModel

      public abstract MovAvgModel neighboringModel()
      Generates a "neighboring" model, where one of the tunable parameters has been randomly mutated within the allowed range. Used for minimization
    • hasValue

      public boolean hasValue​(int valuesAvailable)
      Checks to see this model can produce a new value, without actually running the algo. This can be used for models that have certain preconditions that need to be met in order to short-circuit execution
      Parameters:
      valuesAvailable - Number of values in the current window of values
      Returns:
      Returns `true` if calling next() will produce a value, `false` otherwise
    • next

      public abstract double next​(java.util.Collection<java.lang.Double> values)
      Returns the next value in the series, according to the underlying smoothing model
      Parameters:
      values - Collection of numerics to movingAvg, usually windowed
      Returns:
      Returns a double, since most smoothing methods operate on floating points
    • predict

      public double[] predict​(java.util.Collection<java.lang.Double> values, int numPredictions)
      Predicts the next `n` values in the series.
      Parameters:
      values - Collection of numerics to movingAvg, usually windowed
      numPredictions - Number of newly generated predictions to return
      Returns:
      Returns an array of doubles, since most smoothing methods operate on floating points
    • doPredict

      protected abstract double[] doPredict​(java.util.Collection<java.lang.Double> values, int numPredictions)
      Calls to the model-specific implementation which actually generates the predictions
      Parameters:
      values - Collection of numerics to movingAvg, usually windowed
      numPredictions - Number of newly generated predictions to return
      Returns:
      Returns an array of doubles, since most smoothing methods operate on floating points
    • validate

      protected void validate​(long window, java.lang.String aggregationName)
      This method allows models to validate the window size if required
    • emptyPredictions

      protected double[] emptyPredictions​(int numPredictions)
      Returns an empty set of predictions, filled with NaNs
      Parameters:
      numPredictions - Number of empty predictions to generate
    • writeTo

      public abstract void writeTo​(StreamOutput out) throws java.io.IOException
      Write the model to the output stream
      Specified by:
      writeTo in interface Writeable
      Parameters:
      out - Output stream
      Throws:
      java.io.IOException
    • clone

      public abstract MovAvgModel clone()
      Clone the model, returning an exact copy
      Overrides:
      clone in class java.lang.Object
    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public abstract boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object