Class HoltWintersModel
java.lang.Object
org.elasticsearch.search.aggregations.pipeline.MovAvgModel
org.elasticsearch.search.aggregations.pipeline.HoltWintersModel
- All Implemented Interfaces:
NamedWriteable,Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment
Calculate a triple exponential weighted moving average
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classNested classes/interfaces inherited from class org.elasticsearch.search.aggregations.pipeline.MovAvgModel
MovAvgModel.AbstractModelParserNested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionHoltWintersModel(double alpha, double beta, double gamma, int period, HoltWintersModel.SeasonalityType seasonalityType, boolean pad)Read from a stream. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns if the model can be cost minimized.clone()Clone the model, returning an exact copyprotected double[]doPredict(Collection<Double> values, int numPredictions)Predicts the next `n` values in the series, using the smoothing model to generate new values.booleanReturns the name of the writeable objectinthashCode()booleanhasValue(int valuesAvailable)Checks to see this model can produce a new value, without actually running the algo.booleanShould this model be fit to the data via a cost minimizing algorithm by default?Generates a "neighboring" model, where one of the tunable parameters has been randomly mutated within the allowed range.doublenext(Collection<Double> values)Returns the next value in the series, according to the underlying smoothing modeldouble[]next(Collection<Double> values, int numForecasts)Calculate a doubly exponential weighted moving averageorg.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)protected voidIf the model is a HoltWinters, we need to ensure the window and period are compatible.voidwriteTo(StreamOutput out)Write the model to the output streamMethods inherited from class org.elasticsearch.search.aggregations.pipeline.MovAvgModel
emptyPredictions, predictMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
NAME
- See Also:
- Constant Field Values
-
PARSER
-
-
Constructor Details
-
HoltWintersModel
public HoltWintersModel() -
HoltWintersModel
public HoltWintersModel(double alpha, double beta, double gamma, int period, HoltWintersModel.SeasonalityType seasonalityType, boolean pad) -
HoltWintersModel
Read from a stream.- Throws:
IOException
-
-
Method Details
-
writeTo
Description copied from class:MovAvgModelWrite the model to the output stream- Specified by:
writeToin interfaceWriteable- Specified by:
writeToin classMovAvgModel- Parameters:
out- Output stream- Throws:
IOException
-
getWriteableName
Description copied from interface:NamedWriteableReturns the name of the writeable object -
minimizeByDefault
public boolean minimizeByDefault()Description copied from class:MovAvgModelShould this model be fit to the data via a cost minimizing algorithm by default?- Overrides:
minimizeByDefaultin classMovAvgModel
-
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
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
Description copied from class:MovAvgModelClone the model, returning an exact copy- Specified by:
clonein classMovAvgModel
-
hasValue
public boolean hasValue(int valuesAvailable)Description copied from class:MovAvgModelChecks 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- Overrides:
hasValuein classMovAvgModel- Parameters:
valuesAvailable- Number of values in the current window of values- Returns:
- Returns `true` if calling next() will produce a value, `false` otherwise
-
doPredict
Predicts the next `n` values in the series, using the smoothing model to generate new values. Unlike the other moving averages, HoltWinters has forecasting/prediction built into the algorithm. Prediction is more than simply adding the next prediction to the window and repeating. HoltWinters will extrapolate into the future by applying the trend and seasonal 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
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
Calculate a 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 org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Throws:
IOException
-
validate
If the model is a HoltWinters, we need to ensure the window and period are compatible. This is verified in the XContent parsing, but transport clients need these checks since they skirt XContent parsing- Overrides:
validatein classMovAvgModel
-
hashCode
public int hashCode()- Specified by:
hashCodein classMovAvgModel
-
equals
- Specified by:
equalsin classMovAvgModel
-