# gluonts.model.trivial.mean module¶

class gluonts.model.trivial.mean.MeanEstimator(prediction_length: pydantic.types.PositiveInt, freq: str, num_eval_samples: pydantic.types.PositiveInt)[source]

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

Train the estimator on the given data.

Parameters: training_data – Dataset to train the model on. The predictor containing the trained model. Predictor
class gluonts.model.trivial.mean.MeanPredictor(prediction_length: int, freq: str, num_eval_samples: int = 100, context_length: Optional[int] = None)[source]

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_eval_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]