docstr: Calls the mixer to emit forecasts.
docstr_tok: ["Calls","the","mixer","to","emit","forecasts","."]
code: def __call__(
      self,
      ds: Union[EncodedDs, ConcatedEncodedDs],
      args: PredictionArguments = PredictionArguments(),
  ) -> pd.DataFrame:
      """
      Calls the mixer to emit forecasts.
      """  # noqa
      mx.random.seed(self.seed)
      np.random.seed(self.seed)
      length = (
          sum(ds.encoded_ds_lengths)
          if isinstance(ds, ConcatedEncodedDs)
          else len(ds)
      )
  
      ydf = pd.DataFrame(index=np.arange(length), dtype=object)
      init_arr = [0 for _ in range(self.ts_analysis["tss"].horizon)]
      for col in ["prediction", "lower", "upper"]:
          ydf.at[:, col] = [init_arr for _ in range(len(ydf))]
  
      ydf["index"] = ds.data_frame.index
      conf = args.fixed_confidence if args.fixed_confidence else 0.9
      ydf["confidence"] = conf
  
      gby = (
          self.ts_analysis["tss"].group_by
          if self.ts_analysis["tss"].group_by
          else []
      )
      groups = ds.data_frame[gby[0]].unique().tolist() if gby else None
  
      df = ds.data_frame
      ydf["__original_index"] = df["__mdb_original_index"].values
      input_ds = self._make_initial_ds(
          df, groups=groups
      )  # TODO test with novel group
      forecasts = list(self.model.predict(input_ds))
      grouped = (
          df.groupby(by=gby)
          if gby
          else df.groupby(lambda x: "__default")
      )
      for (group, subdf), group_forecast in zip(grouped, forecasts):
          idx = ydf[
              ydf["__original_index"]
              == max(subdf["__mdb_original_index"])
          ].index.values[0]
          ydf.at[idx, "prediction"] = [
              entry for entry in group_forecast.quantile(0.5)
          ]
          ydf.at[idx, "lower"] = [
              entry for entry in group_forecast.quantile(1 - conf)
          ]
          ydf.at[idx, "upper"] = [
              entry for entry in group_forecast.quantile(conf)
          ]
  
      return ydf
  
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 4 for calling the GluonTSMixer obj's underlying member method code with example usage: obj.__call__(ds, args) and returns: ydf