Class HoltLinearModel
- java.lang.Object
-
- org.elasticsearch.search.aggregations.pipeline.movavg.models.MovAvgModel
-
- org.elasticsearch.search.aggregations.pipeline.movavg.models.HoltLinearModel
-
- All Implemented Interfaces:
NamedWriteable,Writeable,ToXContent,ToXContentFragment
public class HoltLinearModel extends MovAvgModel
Calculate a doubly exponential weighted moving average
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHoltLinearModel.HoltLinearModelBuilder-
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.pipeline.movavg.models.MovAvgModel
MovAvgModel.AbstractModelParser
-
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 Modifier and Type Field Description static doubleDEFAULT_ALPHAstatic doubleDEFAULT_BETAstatic java.lang.StringNAMEstatic MovAvgModel.AbstractModelParserPARSER-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description HoltLinearModel()HoltLinearModel(double alpha, double beta)HoltLinearModel(StreamInput in)Read from a stream.
-
Method Summary
Modifier and Type Method Description booleancanBeMinimized()Returns if the model can be cost minimized.MovAvgModelclone()Clone the model, returning an exact copyprotected double[]doPredict(java.util.Collection<java.lang.Double> values, int numPredictions)Predicts the next `n` values in the series, using the smoothing model to generate new values.booleanequals(java.lang.Object obj)java.lang.StringgetWriteableName()Returns the name of the writeable objectinthashCode()MovAvgModelneighboringModel()Generates a "neighboring" model, where one of the tunable parameters has been randomly mutated within the allowed range.doublenext(java.util.Collection<java.lang.Double> values)Returns the next value in the series, according to the underlying smoothing modeldouble[]next(java.util.Collection<java.lang.Double> values, int numForecasts)Calculate a Holt-Linear (doubly exponential weighted) moving averageXContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)voidwriteTo(StreamOutput out)Write the model to the output stream-
Methods inherited from class org.elasticsearch.search.aggregations.pipeline.movavg.models.MovAvgModel
emptyPredictions, hasValue, minimizeByDefault, predict
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
DEFAULT_ALPHA
public static final double DEFAULT_ALPHA
- See Also:
- Constant Field Values
-
DEFAULT_BETA
public static final double DEFAULT_BETA
- See Also:
- Constant Field Values
-
PARSER
public static final MovAvgModel.AbstractModelParser PARSER
-
-
Constructor Detail
-
HoltLinearModel
public HoltLinearModel()
-
HoltLinearModel
public HoltLinearModel(double alpha, double beta)
-
HoltLinearModel
public HoltLinearModel(StreamInput in) throws java.io.IOException
Read from a stream.- Throws:
java.io.IOException
-
-
Method Detail
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from class:MovAvgModelWrite the model to the output stream- Specified by:
writeToin interfaceWriteable- Specified by:
writeToin classMovAvgModel- Parameters:
out- Output stream- Throws:
java.io.IOException
-
getWriteableName
public java.lang.String getWriteableName()
Description copied from interface:NamedWriteableReturns the name of the writeable object
-
canBeMinimized
public boolean canBeMinimized()
Description copied from class:MovAvgModelReturns if the model can be cost minimized. Not all models have parameters which can be tuned / optimized.- Specified by:
canBeMinimizedin classMovAvgModel
-
neighboringModel
public MovAvgModel neighboringModel()
Description copied from class:MovAvgModelGenerates a "neighboring" model, where one of the tunable parameters has been randomly mutated within the allowed range. Used for minimization- Specified by:
neighboringModelin classMovAvgModel
-
clone
public MovAvgModel clone()
Description copied from class:MovAvgModelClone the model, returning an exact copy- Specified by:
clonein classMovAvgModel
-
doPredict
protected double[] doPredict(java.util.Collection<java.lang.Double> values, int numPredictions)Predicts the next `n` values in the series, using the smoothing model to generate new values. Unlike the other moving averages, Holt-Linear has forecasting/prediction built into the algorithm. Prediction is more than simply adding the next prediction to the window and repeating. Holt-Linear will extrapolate into the future by applying the trend information to the smoothed data.- Specified by:
doPredictin classMovAvgModel- Parameters:
values- Collection of numerics to movingAvg, usually windowednumPredictions- Number of newly generated predictions to return- Returns:
- Returns an array of doubles, since most smoothing methods operate on floating points
-
next
public double next(java.util.Collection<java.lang.Double> values)
Description copied from class:MovAvgModelReturns the next value in the series, according to the underlying smoothing model- Specified by:
nextin classMovAvgModel- Parameters:
values- Collection of numerics to movingAvg, usually windowed- Returns:
- Returns a double, since most smoothing methods operate on floating points
-
next
public double[] next(java.util.Collection<java.lang.Double> values, int numForecasts)Calculate a Holt-Linear (doubly exponential weighted) moving average- Parameters:
values- Collection of values to calculate avg fornumForecasts- number of forecasts into the future to return- Returns:
- Returns a Double containing the moving avg for the window
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Throws:
java.io.IOException
-
hashCode
public int hashCode()
- Specified by:
hashCodein classMovAvgModel
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin classMovAvgModel
-
-