code: def _make_initial_ds(self, df=None, phase="predict", groups=None):
      oby_col_name = "__gluon_timestamp"
      gby = (
          self.ts_analysis["tss"].group_by
          if self.ts_analysis["tss"].group_by
          else []
      )
      freq = self.ts_analysis["sample_freqs"]["__default"]
      keep_cols = (
          [self.target]
          + [col for col in gby]
          + self.static_features_cat
          + self.static_features_real
      )
  
      agg_map = {self.target: "sum"}
      for col in self.static_features_cat:
          agg_map[col] = "first"
      for col in self.static_features_real:
          agg_map[col] = "mean"
  
      if groups is None and gby:
          groups = self.groups
      elif (
          gby
          and phase in ("train", "adjust")
          and self.grouped_by != ["__default"]
      ):
          # we extend all seen groups for subsequent adjustments
          self.groups.extend(set(groups))
  
      if df is None and phase not in ("train", "adjust"):
          df = self.train_cache
          if gby:
              df = df[df[gby[0]].isin(groups)]
      else:
          sub_df = df[keep_cols]
          df = deepcopy(sub_df)
  
          if phase == "train":
              self.train_cache = df.sort_index()
          else:
              if gby:
                  cache = self.train_cache[
                      self.train_cache[gby[0]].isin(groups)
                  ]
              else:
                  cache = self.train_cache
  
              if phase == "adjust":
                  # update cache to include all new information (pre-group filter)
                  self.train_cache = (
                      pd.concat([self.train_cache, df])
                      .drop_duplicates()
                      .sort_index()
                  )
  
              df = pd.concat([cache, df]).sort_index()
  
      df = df.drop_duplicates()
  
      if len(df) == 0:
          return None
  
      if gby:
          # @TODO: multiple group support and remove groups without enough data
          df = (
              df.groupby(by=gby[0])
              .resample(freq)
              .agg(agg_map)
              .reset_index(level=[0])
          )
      else:
          df = df.resample(freq).agg(agg_map)
          gby = "__default_group"
          df[gby] = "__default_group"
  
      df[oby_col_name] = df.index
      for col in self.static_features_cat:
          df[col] = self.static_features_cat_encoders[col].transform(
              df[col].values.reshape(-1, 1)
          )
  
      static_features = []
      if self.static_features_real:
          static_features.extend(self.static_features_real)
      if self.static_features_cat:
          static_features.extend(self.static_features_cat)
      static_features_df = df[static_features]
  
      ds = PandasDataset.from_long_dataframe(
          df,
          target=self.target,
          item_id=gby[0],
          freq=freq,
          timestamp=oby_col_name,
          static_features=static_features_df,
      )
      return ds
  
imports: import importlib
  from copy import deepcopy
  from typing import Dict, Union, Optional, List
  import numpy
  import pandas
  import mxnet
  from sklearn.preprocessing import OrdinalEncoder
  from gluonts.dataset.pandas import PandasDataset
  from gluonts.mx import DeepAREstimator, Trainer
  from gluonts.mx.trainer.callback import TrainingHistory
  from gluonts.mx.distribution.student_t import StudentTOutput
  from lightwood.helpers.log import log
  from lightwood.mixer.base import BaseMixer
  from lightwood.api.types import PredictionArguments
  from lightwood.data.encoded_ds import EncodedDs, ConcatedEncodedDs
label_desc: Use image node_id 5 for calling the GluonTSMixer obj's underlying member method code with example usage: obj._make_initial_ds(df, phase, groups) and returns: ds, None