code: def _to_forecast(
      self,
      ag_output: np.ndarray,
      start_timestamp: pd.Period,
      item_id=None,
  ) -> Forecast:
      if self.quantiles_to_predict:
          forecasts = ag_output.transpose()
          return QuantileForecast(
              start_date=start_timestamp,
              item_id=item_id,
              forecast_arrays=forecasts,
              forecast_keys=self.forecast_keys,
          )
      else:
          samples = ag_output.reshape((1, self.prediction_length))
          return SampleForecast(
              start_date=start_timestamp,
              item_id=item_id,
              samples=samples,
          )
  
imports: from typing import Callable, Dict, List, Optional, Iterator, Iterable, Tuple
  import numpy
  import pandas
  import shutil
  from pathlib import Path
  from autogluon.tabular import TabularPredictor
  from gluonts.core.serde import dump_json, load_json
  from gluonts.dataset.util import to_pandas
  from gluonts.dataset.field_names import FieldName
  from gluonts.itertools import batcher
  from gluonts.model.forecast import SampleForecast, QuantileForecast, Forecast
  from gluonts.model.predictor import Predictor
  from gluonts.time_feature import TimeFeature
label_desc: Use image node_id 3 for calling the TabularPredictor obj's underlying member method code with example usage: obj._to_forecast(ag_output, start_timestamp, item_id) and returns: QuantileForecast, SampleForecast