class_docstr: Wrapper for TimeSeriesDataFrame that is compatible with the GluonTS Dataset API.
class_docstr_tok: ["Wrapper","for","TimeSeriesDataFrame","that","is","compatible","with","the","GluonTS","Dataset","API","."]
code: def __init__(
      self,
      target_df: TimeSeriesDataFrame,
      target_column: str = "target",
      feat_static_cat: Optional[pd.DataFrame] = None,
      feat_static_real: Optional[pd.DataFrame] = None,
      feat_dynamic_real: Optional[pd.DataFrame] = None,
      past_feat_dynamic_real: Optional[pd.DataFrame] = None,
      includes_future: bool = False,
      prediction_length: int = None,
  ):
      assert target_df is not None
      assert (
          target_df.freq
      ), "Initializing GluonTS data sets without freq is not allowed"
      # Convert TimeSeriesDataFrame to pd.Series for faster processing
      self.target_array = self._to_array(
          target_df[target_column], dtype=np.float32
      )
      self.feat_static_cat = self._to_array(
          feat_static_cat, dtype=np.int64
      )
      self.feat_static_real = self._to_array(
          feat_static_real, dtype=np.float32
      )
      self.feat_dynamic_real = self._to_array(
          feat_dynamic_real, dtype=np.float32
      )
      self.past_feat_dynamic_real = self._to_array(
          past_feat_dynamic_real, dtype=np.float32
      )
      self.freq = self._to_gluonts_freq(target_df.freq)
  
      # Necessary to compute indptr for known_covariates at prediction time
      self.includes_future = includes_future
      self.prediction_length = prediction_length
  
      # Replace inefficient groupby ITEMID with indptr that stores start:end of each time series
      item_id_index = target_df.index.get_level_values(ITEMID)
      indices_sizes = item_id_index.value_counts(sort=False)
      self.item_ids = indices_sizes.index  # shape [num_items]
      cum_sizes = indices_sizes.values.cumsum()
      self.indptr = np.append(0, cum_sizes).astype(np.int32)
      self.start_timestamps = (
          target_df.reset_index(TIMESTAMP)
          .groupby(level=ITEMID, sort=False)
          .first()[TIMESTAMP]
      )
      assert len(self.item_ids) == len(self.start_timestamps)
  
imports: import logging
  import os
  import shutil
  from datetime import timedelta
  from pathlib import Path
  from typing import Any, Callable, Dict, Iterator, List, Optional, Type, Union
  import gluonts
  import gluonts.core.settings
  import numpy
  import pandas
  from gluonts.core.component import from_hyperparameters
  from gluonts.dataset.common import Dataset
  from gluonts.dataset.field_names import FieldName
  from gluonts.model.estimator import Estimator
  from gluonts.model.forecast import Forecast, QuantileForecast, SampleForecast
  from gluonts.model.predictor import Predictor
  from pandas.tseries.frequencies import to_offset
  from autogluon.common.loaders import load_pkl
  from autogluon.common.utils.log_utils import set_logger_verbosity
  from autogluon.core.hpo.constants import RAY_BACKEND
  from autogluon.timeseries.dataset.ts_dataframe import ITEMID, TIMESTAMP, TimeSeriesDataFrame
  from autogluon.timeseries.models.abstract import AbstractTimeSeriesModel
  from autogluon.timeseries.utils.datetime import norm_freq_str
  from autogluon.timeseries.utils.forecast import get_forecast_horizon_index_ts_dataframe
  from autogluon.timeseries.utils.warning_filters import disable_root_logger, warning_filter
label_desc: Use image node_id 1 to create a new SimpleGluonTSDataset object from inherited base classes: GluonTSDataset with example: obj = SimpleGluonTSDataset(target_df, target_column, feat_static_cat, feat_static_real, feat_dynamic_real, past_feat_dynamic_real, includes_future, prediction_length)