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

Predictor

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.

predict_item(item: Dict[str, Any]) → gluonts.model.forecast.SampleForecast[source]