docstr: Defines an estimator.
  
  All parameters should be serializable.
docstr_tok: ["Defines","an","estimator",".","All","parameters","should","be","serializable","."]
code: def __init__(
      self,
      prediction_length: int,
      freq: int,
      trainer: Trainer = Trainer(),
      context_length: Optional[int] = None,
      num_parallel_samples: int = 100,
  ) -> None:
      """
      Defines an estimator.
  
      All parameters should be serializable.
      """
      super().__init__(trainer=trainer)
      self.num_parallel_samples = num_parallel_samples
      self.freq = freq
  
      self.prediction_length = prediction_length
      self.context_length = (
          context_length
          if context_length is not None
          else prediction_length
      )
  
file_path: gluonts/src/gluonts/nursery/SCott/model/ar/ar_estimator.py
imports: from typing import List, Optional
  import torch
  import torch.nn
  from pts import Trainer
  from pts.dataset import FieldName
  from pts.model import PTSEstimator, PTSPredictor, copy_parameters
  from pts.modules import DistributionOutput, StudentTOutput
  from pts.transform import Transformation, Chain, InstanceSplitter, ExpectedNumInstanceSampler
  from pts.transform.sampler import CustomUniformSampler
  from .ar_network import ARTrainingNetwork, ARPredictionNetwork
label_desc: Use image node_id 1 to create a new AREstimator object from inherited base classes: PTSEstimator with example: obj = AREstimator(prediction_length, freq, trainer, context_length, num_parallel_samples)