Table Of Contents
Table Of Contents

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.

  • 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.
train(training_data: gluonts.dataset.common.Dataset, validation_dataset: Optional[gluonts.dataset.common.Dataset] = None) → gluonts.model.trivial.constant.ConstantPredictor[source]

Train the estimator on the given data.

  • training_data – Dataset to train the model on.
  • validation_data – Dataset to validate the model on during training.

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.

  • 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.
predict_item(item: Dict[str, Any]) → gluonts.model.forecast.SampleForecast[source]