class_docstr: A `Forecast` object, where the predicted distribution is represented
  internally as samples.
  
  Parameters
  ----------
  samples
      Array of size (num_samples, prediction_length) (1D case) or
      (num_samples, prediction_length, target_dim) (multivariate case)
  start_date
      Start of the forecast.
  item_id
      Identifier of the item being forecasted.
  info
      Additional information that the forecaster may provide e.g. estimated
      parameters, number of iterations ran etc.
class_docstr_tok: ["A","`","Forecast","`","object",",","where","the","predicted","distribution","is","represented","internally","as","samples",".","Parameters","--","--","--","--","--","samples","Array","of","size","(","num_samples",",","prediction_length",")","(","1D","case",")","or","(","num_samples",",","prediction_length",",","target_dim",")","(","multivariate","case",")","start_date","Start","of","the","forecast",".","item_id","Identifier","of","the","item","being","forecasted",".","info","Additional","information","that","the","forecaster","may","provide","e.g",".","estimated","parameters",",","number","of","iterations","ran","etc","."]
code: def __init__(
      self,
      samples: np.ndarray,
      start_date: pd.Period,
      item_id: Optional[str] = None,
      info: Optional[Dict] = None,
  ) -> None:
      assert isinstance(
          samples, np.ndarray
      ), "samples should be a numpy array"
      assert (
          len(np.shape(samples)) == 2 or len(np.shape(samples)) == 3
      ), (
          "samples should be a 2-dimensional or 3-dimensional array."
          " Dimensions found: {}".format(len(np.shape(samples)))
      )
      self.samples = samples
      self._sorted_samples_value = None
      self._mean = None
      self._dim: Optional[int] = None
      self.item_id = item_id
      self.info = info
  
      assert isinstance(
          start_date, pd.Period
      ), "start_date should be a pandas Period object"
      self.start_date = start_date
  
imports: import re
  import logging
  from dataclasses import field
  from typing import Callable, Dict, List, Optional, Union, Tuple
  import numpy
  import pandas
  from gluonts.core.component import validated
  from gluonts.pydantic import dataclass
  from gluonts import maybe
label_desc: Use image node_id 1 to create a new SampleForecast object from inherited base classes: Forecast with example: obj = SampleForecast(samples, start_date, item_id, info)