gluonts.model.trivial.mean module¶
-
class
gluonts.model.trivial.mean.
MeanEstimator
(prediction_length: pydantic.types.PositiveInt, freq: str, num_samples: pydantic.types.PositiveInt)[source]¶ Bases:
gluonts.model.estimator.Estimator
An Estimator that computes the mean targets in the training data, in the trailing prediction_length observations, and produces a ConstantPredictor that always predicts such mean value.
- Parameters
prediction_length – Prediction horizon.
freq – Frequency of the predicted data.
num_samples – Number of samples to include in the forecasts. Not that the samples produced by this predictor will all be identical.
-
freq
= None¶
-
lead_time
= None¶
-
prediction_length
= None¶
-
train
(training_data: Iterable[Dict[str, Any]], validation_dataset: Optional[Iterable[Dict[str, Any]]] = None) → gluonts.model.trivial.constant.ConstantPredictor[source]¶ Train the estimator on the given data.
- Parameters
training_data – Dataset to train the model on.
validation_data – Dataset to validate the model on during training.
- Returns
The predictor containing the trained model.
- Return type
-
class
gluonts.model.trivial.mean.
MeanPredictor
(prediction_length: int, freq: str, num_samples: int = 100, context_length: Optional[int] = None)[source]¶ Bases:
gluonts.model.predictor.RepresentablePredictor
,gluonts.model.predictor.FallbackPredictor
A
Predictor
that predicts the samples based on the mean of the last context_length elements of the input target.- Parameters
context_length – Length of the target context used to condition the predictions.
prediction_length – Length of the prediction horizon.
num_samples – Number of samples to use to construct
SampleForecast
objects for every prediction.freq – Frequency of the predicted data.
-
class
gluonts.model.trivial.mean.
MovingAveragePredictor
(prediction_length: int, freq: str, context_length: Optional[int] = None)[source]¶ Bases:
gluonts.model.predictor.RepresentablePredictor
A
Predictor
that predicts the moving average based on the last context_length elements of the input target.If prediction_length = 1, the output is the moving average based on the last context_length elements of the input target.
If prediction_length > 1, the output is the moving average based on the last context_length elements of the input target, where previously calculated moving averages are appended at the end of the input target. Hence, for prediction_length larger than context_length, there will be cases where the moving average is calculated on top of previous moving averages.
- Parameters
context_length – Length of the target context used to condition the predictions.
prediction_length – Length of the prediction horizon.
freq – Frequency of the predicted data.