class_docstr: A :class:`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 inputtarget.
  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.
code: def __init__(
      self,
      prediction_length: int,
      context_length: Optional[int] = None,
  ) -> None:
      super().__init__(prediction_length=prediction_length)
  
      if context_length is not None:
          assert (
              context_length >= 1
          ), "The value of 'context_length' should be >= 1 or None"
  
      self.context_length = context_length
  
imports: from typing import Optional
  import numpy
  from gluonts.core.component import validated
  from gluonts.dataset.common import DataEntry, Dataset
  from gluonts.dataset.field_names import FieldName
  from gluonts.dataset.util import forecast_start
  from gluonts.model.estimator import Estimator
  from gluonts.model.forecast import SampleForecast
  from gluonts.model.predictor import RepresentablePredictor
  from gluonts.model.trivial.constant import ConstantPredictor
  from gluonts.pydantic import PositiveInt
label_desc: Use image node_id 1 to create a new MovingAveragePredictor object from inherited base classes: RepresentablePredictor with example: obj = MovingAveragePredictor(prediction_length, context_length)