class_docstr: Predict all future time series values simultaneously using TabularPredictor from AutoGluon-Tabular.
  
  A single TabularPredictor is used to forecast all future time series values using the following features:
  
  - lag features (observed time series values) based on ``freq`` of the data
  - time features (e.g., day of the week) based on the timestamp of the measurement
  - known covariates (if available)
  - static features of each item (if available)
  
  Features not known during the forecast horizon (e.g., future target values) are replaced by NaNs.
  
  If ``eval_metric.needs_quantile``, the TabularPredictor will be trained with ``"quantile"`` problem type.
  Otherwise, TabularPredictor will be trained with ``"regression"`` problem type, and dummy quantiles will be
  obtained by assuming that the residuals follow zero-mean normal distribution.
  
  Based on the `mlforecast <https://github.com/Nixtla/mlforecast>`_ library.
  
  
  Other Parameters
  ----------------
  lags : List[int], default = None
      Lags of the target that will be used as features for predictions. If None, will be determined automatically
      based on the frequency of the data.
  date_features : List[Union[str, Callable]], default = None
      Features computed from the dates. Can be pandas date attributes or functions that will take the dates as input.
      If None, will be determined automatically based on the frequency of the data.
  differences : List[int], default = []
      Differences to take of the target before computing the features. These are restored at the forecasting step.
      If None, will be set to ``[seasonal_period]``, where seasonal_period is determined based on the data frequency.
      Defaults to no differencing.
  scaler : {"standard", "mean_abs", None}, default = "mean_abs"
      Scaling applied to each time series.
  tabular_hyperparameters : Dict[Dict[str, Any]], optional
      Hyperparameters dictionary passed to ``TabularPredictor.fit``. Contains the names of models that should be fit.
      Defaults to ``{"GBM": {}}``.
  tabular_fit_kwargs : Dict[str, Any], optional
      Additional keyword arguments passed to ``TabularPredictor.fit``. Defaults to an empty dict.
  max_num_items : int or None, default = 20_000
      If not None, the model will randomly select this many time series for training and validation.
  max_num_samples : int or None, default = 1_000_000
      If not None, training dataset passed to TabularPredictor will contain at most this many rows (starting from the
      end of each time series).
class_docstr_tok: ["Predict","all","future","time","series","values","simultaneously","using","TabularPredictor","from","AutoGluon-Tabular",".","A","single","TabularPredictor","is","used","to","forecast","all","future","time","series","values","using","the","following","features",":","-","lag","features","(","observed","time","series","values",")","based","on","``","freq","``","of","the","data","-","time","features","(","e.g.",",","day","of","the","week",")","based","on","the","timestamp","of","the","measurement","-","known","covariates","(","if","available",")","-","static","features","of","each","item","(","if","available",")","Features","not","known","during","the","forecast","horizon","(","e.g.",",","future","target","values",")","are","replaced","by","NaNs",".","If","``","eval_metric.needs_quantile","``",",","the","TabularPredictor","will","be","trained","with","``","``","quantile","''","``","problem","type",".","Otherwise",",","TabularPredictor","will","be","trained","with","``","``","regression","''","``","problem","type",",","and","dummy","quantiles","will","be","obtained","by","assuming","that","the","residuals","follow","zero-mean","normal","distribution",".","Based","on","the","`","mlforecast","<","https",":","\/\/github.com\/Nixtla\/mlforecast",">","`","_","library",".","Other","Parameters","--","--","--","--","--","--","--","--","lags",":","List","[","int","]",",","default","=","None","Lags","of","the","target","that","will","be","used","as","features","for","predictions",".","If","None",",","will","be","determined","automatically","based","on","the","frequency","of","the","data",".","date_features",":","List","[","Union","[","str",",","Callable","]","]",",","default","=","None","Features","computed","from","the","dates",".","Can","be","pandas","date","attributes","or","functions","that","will","take","the","dates","as","input",".","If","None",",","will","be","determined","automatically","based","on","the","frequency","of","the","data",".","differences",":","List","[","int","]",",","default","=","[","]","Differences","to","take","of","the","target","before","computing","the","features",".","These","are","restored","at","the","forecasting","step",".","If","None",",","will","be","set","to","``","[","seasonal_period","]","``",",","where","seasonal_period","is","determined","based","on","the","data","frequency",".","Defaults","to","no","differencing",".","scaler",":","{","``","standard","''",",","``","mean_abs","''",",","None","}",",","default","=","``","mean_abs","''","Scaling","applied","to","each","time","series",".","tabular_hyperparameters",":","Dict","[","Dict","[","str",",","Any","]","]",",","optional","Hyperparameters","dictionary","passed","to","``","TabularPredictor.fit","``",".","Contains","the","names","of","models","that","should","be","fit",".","Defaults","to","``","{","``","GBM","''",":","{","}","}","``",".","tabular_fit_kwargs",":","Dict","[","str",",","Any","]",",","optional","Additional","keyword","arguments","passed","to","``","TabularPredictor.fit","``",".","Defaults","to","an","empty","dict",".","max_num_items",":","int","or","None",",","default","=","20_000","If","not","None",",","the","model","will","randomly","select","this","many","time","series","for","training","and","validation",".","max_num_samples",":","int","or","None",",","default","=","1_000_000","If","not","None",",","training","dataset","passed","to","TabularPredictor","will","contain","at","most","this","many","rows","(","starting","from","the","end","of","each","time","series",")","."]
code: def _predict(
      self,
      data: TimeSeriesDataFrame,
      known_covariates: Optional[TimeSeriesDataFrame] = None,
      **kwargs,
  ) -> TimeSeriesDataFrame:
      original_item_id_order = data.item_ids
      (
          data,
          known_covariates,
          forecast_for_short_series,
      ) = self._remove_short_ts_and_generate_fallback_forecast(
          data=data, known_covariates=known_covariates
      )
      if len(data) == 0:
          # All time series are too short for chosen differences
          return forecast_for_short_series
  
      if known_covariates is not None:
          data_future = known_covariates.copy()
      else:
          future_index = get_forecast_horizon_index_ts_dataframe(
              data, self.prediction_length
          )
          data_future = pd.DataFrame(
              columns=[self.target], index=future_index, dtype="float32"
          )
      # MLForecast raises exception of target contains NaN. We use inf as placeholder, replace them by NaN afterwards
      data_future[self.target] = float("inf")
      data_extended = pd.concat([data, data_future])
      mlforecast_df = self._to_mlforecast_df(
          data_extended, data.static_features
      )
      if self._max_ts_length is not None:
          # We appended `prediction_length` time steps to each series, so increase length
          mlforecast_df = self._shorten_all_series(
              mlforecast_df,
              self._max_ts_length + self.prediction_length,
          )
      df = self._mlf.preprocess(
          mlforecast_df, dropna=False, static_features=[]
      )
      df = df.groupby(MLF_ITEMID, sort=False).tail(
          self.prediction_length
      )
      df = df.replace(float("inf"), float("nan"))
  
      raw_predictions = self._mlf.models_["mean"].predict(df)
      predictions = self._postprocess_predictions(
          raw_predictions, repeated_item_ids=df[MLF_ITEMID]
      )
      # Paste columns one by one to preserve dtypes
      predictions[MLF_ITEMID] = df[MLF_ITEMID].values
      predictions[MLF_TIMESTAMP] = df[MLF_TIMESTAMP].values
  
      if hasattr(self._mlf.ts, "target_transforms"):
          # Ensure that transforms are fitted only on past data
          mlforecast_df_past = self._to_mlforecast_df(data, None)
          if self._max_ts_length is not None:
              mlforecast_df_past = self._shorten_all_series(
                  mlforecast_df_past, self._max_ts_length
              )
          self._mlf.preprocess(mlforecast_df_past, static_features=[])
          for tfm in self._mlf.ts.target_transforms[::-1]:
              predictions = tfm.inverse_transform(predictions)
      predictions = TimeSeriesDataFrame(
          predictions.rename(
              columns={MLF_ITEMID: ITEMID, MLF_TIMESTAMP: TIMESTAMP}
          )
      )
  
      if forecast_for_short_series is not None:
          predictions = pd.concat(
              [predictions, forecast_for_short_series]
          )
          predictions = predictions.reindex(
              original_item_id_order, level=ITEMID
          )
      return predictions
  
imports: import logging
  import math
  import os
  import time
  from typing import Any, Dict, List, Optional, Tuple
  import numpy
  import pandas
  from sklearn.base import BaseEstimator
  import autogluon.core
  from autogluon.common.utils.log_utils import set_logger_verbosity
  from autogluon.tabular import TabularPredictor
  from autogluon.timeseries.dataset.ts_dataframe import ITEMID, TIMESTAMP, TimeSeriesDataFrame
  from autogluon.timeseries.models.abstract import AbstractTimeSeriesModel
  from autogluon.timeseries.models.local import SeasonalNaiveModel
  from autogluon.timeseries.utils.datetime import get_lags_for_frequency, get_seasonality, get_time_features_for_frequency
  from autogluon.timeseries.utils.forecast import get_forecast_horizon_index_ts_dataframe
  from autogluon.timeseries.utils.warning_filters import warning_filter
label_desc: Use image node_id 5 for calling the DirectTabularModel obj's underlying member method code with example usage: obj._predict(data, known_covariates) and returns: predictions, forecast_for_short_series