Class LinearModel
java.lang.Object
org.elasticsearch.search.aggregations.pipeline.MovAvgModel
org.elasticsearch.search.aggregations.pipeline.LinearModel
- All Implemented Interfaces:
NamedWriteable,Writeable,ToXContent,ToXContentFragment
public class LinearModel extends MovAvgModel
Calculate a linearly weighted moving average, such that older values are
linearly less important. "Time" is determined by position in collection
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLinearModel.LinearModelBuilderNested classes/interfaces inherited from class org.elasticsearch.search.aggregations.pipeline.MovAvgModel
MovAvgModel.AbstractModelParserNested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested 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 java.lang.StringNAMEstatic MovAvgModel.AbstractModelParserPARSER -
Constructor Summary
Constructors Constructor Description LinearModel()LinearModel(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)Calls to the model-specific implementation which actually generates the predictionsbooleanequals(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 modelXContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)voidwriteTo(StreamOutput out)Write the model to the output streamMethods inherited from class org.elasticsearch.search.aggregations.pipeline.MovAvgModel
emptyPredictions, hasValue, minimizeByDefault, predict, validate
-
Field Details
-
NAME
public static final java.lang.String NAME- See Also:
- Constant Field Values
-
PARSER
-
-
Constructor Details
-
LinearModel
public LinearModel() -
LinearModel
Read from a stream.
-
-
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:
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
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
-
doPredict
protected double[] doPredict(java.util.Collection<java.lang.Double> values, int numPredictions)Description copied from class:MovAvgModelCalls to the model-specific implementation which actually generates the predictions- 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
-
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
-