class_docstr: AutoGluon ``TimeSeriesPredictor`` predicts future values of multiple related time series.
  
  ``TimeSeriesPredictor`` provides probabilistic (quantile) multi-step-ahead forecasts for univariate time series.
  The forecast includes both the mean (i.e., conditional expectation of future values given the past), as well as the
  quantiles of the forecast distribution, indicating the range of possible future outcomes.
  
  ``TimeSeriesPredictor`` fits both "global" deep learning models that are shared across all time series
  (e.g., DeepAR, Transformer), as well as "local" statistical models that are fit to each individual time series
  (e.g., ARIMA, ETS).
  
  ``TimeSeriesPredictor`` expects input data and makes predictions in the
  :class:`~autogluon.timeseries.TimeSeriesDataFrame` format.
  
  
  Parameters
  ----------
  target : str, default = "target"
      Name of column that contains the target values to forecast (i.e., numeric observations of the time series).
  prediction_length : int, default = 1
      The forecast horizon, i.e., How many time steps into the future the models should be trained to predict.
      For example, if time series contain daily observations, setting ``prediction_length = 3`` will train
      models that predict up to 3 days into the future from the most recent observation.
  freq : str, optional
      Frequency of the time series data (see `pandas documentation <https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`_
      for available frequencies). For example, ``"D"`` for daily data or ``"H"`` for hourly data.
  
      By default, the predictor will attempt to automatically infer the frequency from the data. This argument should
      only be set in two cases:
  
      1. The time series data has irregular timestamps, so frequency cannot be inferred automatically.
      2. You would like to resample the original data at a different frequency (for example, convert hourly measurements into daily measurements).
  
      If ``freq`` is provided when creating the predictor, all data passed to the predictor will be automatically
      resampled at this frequency.
  eval_metric : Union[str, TimeSeriesScorer], default = "WQL"
      Metric by which predictions will be ultimately evaluated on future test data. AutoGluon tunes hyperparameters
      in order to improve this metric on validation data, and ranks models (on validation data) according to this
      metric.
  
      Probabilistic forecast metrics (evaluated on quantile forecasts for the specified ``quantile_levels``):
  
      - ``"SQL"``: scaled quantile loss
      - ``"WQL"``: weighted quantile loss
  
      Point forecast metrics (these are always evaluated on the ``"mean"`` column of the predictions):
  
      - ``"MAE"``: mean absolute error
      - ``"MAPE"``: mean absolute percentage error
      - ``"MASE"``: mean absolute scaled error
      - ``"MSE"``: mean squared error
      - ``"RMSE"``: root mean squared error
      - ``"RMSSE"``: root mean squared scaled error
      - ``"SMAPE"``: "symmetric" mean absolute percentage error
      - ``"WAPE"``: weighted absolute percentage error
  
      For more information about these metrics, see :ref:`Forecasting Time Series - Evaluation Metrics <forecasting_metrics>`.
  eval_metric_seasonal_period : int, optional
      Seasonal period used to compute some evaluation metrics such as mean absolute scaled error (MASE). Defaults to
      ``None``, in which case the seasonal period is computed based on the data frequency.
  known_covariates_names: List[str], optional
      Names of the covariates that are known in advance for all time steps in the forecast horizon. These are also
      known as dynamic features, exogenous variables, additional regressors or related time series. Examples of such
      covariates include holidays, promotions or weather forecasts.
  
      Currently, only numeric (float of integer dtype) are supported.
  
      If ``known_covariates_names`` are provided, then:
  
      - :meth:`~autogluon.timeseries.TimeSeriesPredictor.fit`, :meth:`~autogluon.timeseries.TimeSeriesPredictor.evaluate`, and :meth:`~autogluon.timeseries.TimeSeriesPredictor.leaderboard` will expect a data frame with columns listed in ``known_covariates_names`` (in addition to the ``target`` column).
      - :meth:`~autogluon.timeseries.TimeSeriesPredictor.predict` will expect an additional keyword argument ``known_covariates`` containing the future values of the known covariates in ``TimeSeriesDataFrame`` format.
  
  quantile_levels : List[float], optional
      List of increasing decimals that specifies which quantiles should be estimated when making distributional
      forecasts. Defaults to ``[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]``.
  path : str or pathlib.Path, optional
      Path to the directory where models and intermediate outputs will be saved. Defaults to a timestamped folder
      ``AutogluonModels/ag-[TIMESTAMP]`` that will be created in the working directory.
  verbosity : int, default = 2
      Verbosity levels range from 0 to 4 and control how much information is printed to stdout. Higher levels
      correspond to more detailed print statements, and ``verbosity=0`` suppresses output including warnings.
      If using ``logging``, you can alternatively control amount of information printed via ``logger.setLevel(L)``,
      where ``L`` ranges from 0 to 50 (Note: higher values of ``L`` correspond to fewer print statements, opposite
      of verbosity levels).
  cache_predictions : bool, default = True
      If True, the predictor will cache and reuse the predictions made by individual models whenever
      :meth:`~autogluon.timeseries.TimeSeriesPredictor.predict`, :meth:`~autogluon.timeseries.TimeSeriesPredictor.leaderboard`,
      or :meth:`~autogluon.timeseries.TimeSeriesPredictor.evaluate` methods are called. This allows to significantly
      speed up these methods. If False, caching will be disabled. You can set this argument to False to reduce disk
      usage at the cost of longer prediction times.
  label : str, optional
      Alias for :attr:`target`.
class_docstr_tok: ["AutoGluon","``","TimeSeriesPredictor","``","predicts","future","values","of","multiple","related","time","series",".","``","TimeSeriesPredictor","``","provides","probabilistic","(","quantile",")","multi-step-ahead","forecasts","for","univariate","time","series",".","The","forecast","includes","both","the","mean","(","i.e.",",","conditional","expectation","of","future","values","given","the","past",")",",","as","well","as","the","quantiles","of","the","forecast","distribution",",","indicating","the","range","of","possible","future","outcomes",".","``","TimeSeriesPredictor","``","fits","both","``","global","''","deep","learning","models","that","are","shared","across","all","time","series","(","e.g.",",","DeepAR",",","Transformer",")",",","as","well","as","``","local","''","statistical","models","that","are","fit","to","each","individual","time","series","(","e.g.",",","ARIMA",",","ETS",")",".","``","TimeSeriesPredictor","``","expects","input","data","and","makes","predictions","in","the",":","class",":","`","~autogluon.timeseries.TimeSeriesDataFrame","`","format",".","Parameters","--","--","--","--","--","target",":","str",",","default","=","``","target","''","Name","of","column","that","contains","the","target","values","to","forecast","(","i.e.",",","numeric","observations","of","the","time","series",")",".","prediction_length",":","int",",","default","=","1","The","forecast","horizon",",","i.e.",",","How","many","time","steps","into","the","future","the","models","should","be","trained","to","predict",".","For","example",",","if","time","series","contain","daily","observations",",","setting","``","prediction_length","=","3","``","will","train","models","that","predict","up","to","3","days","into","the","future","from","the","most","recent","observation",".","freq",":","str",",","optional","Frequency","of","the","time","series","data","(","see","`","pandas","documentation","<","https",":","\/\/pandas.pydata.org\/pandas-docs\/stable\/user_guide\/timeseries.html","#","offset-aliases",">","`","_","for","available","frequencies",")",".","For","example",",","``","``","D","''","``","for","daily","data","or","``","``","H","''","``","for","hourly","data",".","By","default",",","the","predictor","will","attempt","to","automatically","infer","the","frequency","from","the","data",".","This","argument","should","only","be","set","in","two","cases",":","1",".","The","time","series","data","has","irregular","timestamps",",","so","frequency","can","not","be","inferred","automatically",".","2",".","You","would","like","to","resample","the","original","data","at","a","different","frequency","(","for","example",",","convert","hourly","measurements","into","daily","measurements",")",".","If","``","freq","``","is","provided","when","creating","the","predictor",",","all","data","passed","to","the","predictor","will","be","automatically","resampled","at","this","frequency",".","eval_metric",":","Union","[","str",",","TimeSeriesScorer","]",",","default","=","``","WQL","''","Metric","by","which","predictions","will","be","ultimately","evaluated","on","future","test","data",".","AutoGluon","tunes","hyperparameters","in","order","to","improve","this","metric","on","validation","data",",","and","ranks","models","(","on","validation","data",")","according","to","this","metric",".","Probabilistic","forecast","metrics","(","evaluated","on","quantile","forecasts","for","the","specified","``","quantile_levels","``",")",":","-","``","``","SQL","''","``",":","scaled","quantile","loss","-","``","``","WQL","''","``",":","weighted","quantile","loss","Point","forecast","metrics","(","these","are","always","evaluated","on","the","``","``","mean","''","``","column","of","the","predictions",")",":","-","``","``","MAE","''","``",":","mean","absolute","error","-","``","``","MAPE","''","``",":","mean","absolute","percentage","error","-","``","``","MASE","''","``",":","mean","absolute","scaled","error","-","``","``","MSE","''","``",":","mean","squared","error","-","``","``","RMSE","''","``",":","root","mean","squared","error","-","``","``","RMSSE","''","``",":","root","mean","squared","scaled","error","-","``","``","SMAPE","''","``",":","``","symmetric","''","mean","absolute","percentage","error","-","``","``","WAPE","''","``",":","weighted","absolute","percentage","error","For","more","information","about","these","metrics",",","see",":","ref",":","`","Forecasting","Time","Series","-","Evaluation","Metrics","<","forecasting_metrics",">","`",".","eval_metric_seasonal_period",":","int",",","optional","Seasonal","period","used","to","compute","some","evaluation","metrics","such","as","mean","absolute","scaled","error","(","MASE",")",".","Defaults","to","``","None","``",",","in","which","case","the","seasonal","period","is","computed","based","on","the","data","frequency",".","known_covariates_names",":","List","[","str","]",",","optional","Names","of","the","covariates","that","are","known","in","advance","for","all","time","steps","in","the","forecast","horizon",".","These","are","also","known","as","dynamic","features",",","exogenous","variables",",","additional","regressors","or","related","time","series",".","Examples","of","such","covariates","include","holidays",",","promotions","or","weather","forecasts",".","Currently",",","only","numeric","(","float","of","integer","dtype",")","are","supported",".","If","``","known_covariates_names","``","are","provided",",","then",":","-",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.fit","`",",",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.evaluate","`",",","and",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.leaderboard","`","will","expect","a","data","frame","with","columns","listed","in","``","known_covariates_names","``","(","in","addition","to","the","``","target","``","column",")",".","-",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.predict","`","will","expect","an","additional","keyword","argument","``","known_covariates","``","containing","the","future","values","of","the","known","covariates","in","``","TimeSeriesDataFrame","``","format",".","quantile_levels",":","List","[","float","]",",","optional","List","of","increasing","decimals","that","specifies","which","quantiles","should","be","estimated","when","making","distributional","forecasts",".","Defaults","to","``","[","0.1",",","0.2",",","0.3",",","0.4",",","0.5",",","0.6",",","0.7",",","0.8",",","0.9","]","``",".","path",":","str","or","pathlib.Path",",","optional","Path","to","the","directory","where","models","and","intermediate","outputs","will","be","saved",".","Defaults","to","a","timestamped","folder","``","AutogluonModels\/ag-","[","TIMESTAMP","]","``","that","will","be","created","in","the","working","directory",".","verbosity",":","int",",","default","=","2","Verbosity","levels","range","from","0","to","4","and","control","how","much","information","is","printed","to","stdout",".","Higher","levels","correspond","to","more","detailed","print","statements",",","and","``","verbosity=0","``","suppresses","output","including","warnings",".","If","using","``","logging","``",",","you","can","alternatively","control","amount","of","information","printed","via","``","logger.setLevel","(","L",")","``",",","where","``","L","``","ranges","from","0","to","50","(","Note",":","higher","values","of","``","L","``","correspond","to","fewer","print","statements",",","opposite","of","verbosity","levels",")",".","cache_predictions",":","bool",",","default","=","True","If","True",",","the","predictor","will","cache","and","reuse","the","predictions","made","by","individual","models","whenever",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.predict","`",",",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.leaderboard","`",",","or",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.evaluate","`","methods","are","called",".","This","allows","to","significantly","speed","up","these","methods",".","If","False",",","caching","will","be","disabled",".","You","can","set","this","argument","to","False","to","reduce","disk","usage","at","the","cost","of","longer","prediction","times",".","label",":","str",",","optional","Alias","for",":","attr",":","`","target","`","."]
docstr: Fit probabilistic forecasting models to the given time series dataset.
  
  Parameters
  ----------
  train_data : Union[TimeSeriesDataFrame, pd.DataFrame, str]
      Training data in the :class:`~autogluon.timeseries.TimeSeriesDataFrame` format.
  
      Time series with length ``<= (num_val_windows + 1) * prediction_length`` will be ignored during training.
      See :attr:`num_val_windows` for details.
  
      If ``known_covariates_names`` were specified when creating the predictor, ``train_data`` must include the
      columns listed in ``known_covariates_names`` with the covariates values aligned with the target time series.
      The known covariates must have a numeric (float or integer) dtype.
  
      Columns of ``train_data`` except ``target`` and those listed in ``known_covariates_names`` will be
      interpreted as ``past_covariates`` - covariates that are known only in the past.
  
      If ``train_data`` has static features (i.e., ``train_data.static_features`` is a pandas DataFrame), the
      predictor will interpret columns with ``int`` and ``float`` dtypes as continuous (real-valued) features,
      columns with ``object`` and ``str`` dtypes as categorical features, and will ignore the rest of columns.
  
      For example, to ensure that column "store_id" with dtype ``int`` is interpreted as a category,
      we need to change its type to ``category``::
  
          data.static_features["store_id"] = data.static_features["store_id"].astype("category")
  
      If provided data is an instance of pandas DataFrame, AutoGluon will attempt to automatically convert it
      to a ``TimeSeriesDataFrame``.
  
  tuning_data : Union[TimeSeriesDataFrame, pd.DataFrame, str], optional
      Data reserved for model selection and hyperparameter tuning, rather than training individual models. Also
      used to compute the validation scores. Note that only the last ``prediction_length`` time steps of each
      time series are used for computing the validation score.
  
      If ``tuning_data`` is provided, multi-window backtesting on training data will be disabled, the
      :attr:`num_val_windows` will be set to ``0``, and :attr:`refit_full` will be set to ``False``.
  
      Leaving this argument empty and letting AutoGluon automatically generate the validation set from
      ``train_data`` is a good default.
  
      If ``known_covariates_names`` were specified when creating the predictor, ``tuning_data`` must also include
      the columns listed in ``known_covariates_names`` with the covariates values aligned with the target time
      series.
  
      If ``train_data`` has past covariates or static features, ``tuning_data`` must have also include them (with
      same columns names and dtypes).
  
      If provided data is an instance of pandas DataFrame, AutoGluon will attempt to automatically convert it
      to a ``TimeSeriesDataFrame``.
  
  time_limit : int, optional
      Approximately how long :meth:`~autogluon.timeseries.TimeSeriesPredictor.fit` will run (wall-clock time in
      seconds). If not specified, :meth:`~autogluon.timeseries.TimeSeriesPredictor.fit` will run until all models
      have completed training.
  presets : str, optional
      Optional preset configurations for various arguments in
      :meth:`~autogluon.timeseries.TimeSeriesPredictor.fit`.
  
      Can significantly impact predictive accuracy, memory footprint, inference latency of trained models,
      and various other properties of the returned predictor. It is recommended to specify presets and avoid
      specifying most other :meth:`~autogluon.timeseries.TimeSeriesPredictor.fit` arguments or model
      hyperparameters prior to becoming familiar with AutoGluon. For example, set ``presets="high_quality"``
      to get a high-accuracy predictor, or set ``presets="fast_training"`` to quickly get the results.
      Any user-specified arguments in :meth:`~autogluon.timeseries.TimeSeriesPredictor.fit` will
      override the values used by presets.
  
      Available presets:
  
      - ``"fast_training"``: fit simple statistical models (``ETS``, ``Theta``, ``Naive``, ``SeasonalNaive``) + fast tree-based models ``RecursiveTabular`` and ``DirectTabular``. These models are fast to train but may not be very accurate.
      - ``"medium_quality"``: all models mentioned above + deep learning model ``TemporalFusionTransformer``. Default setting that produces good forecasts with reasonable training time.
      - ``"high_quality"``: All ML models available in AutoGluon + additional statistical models (``NPTS``, ``AutoETS``, ``AutoARIMA``, ``CrostonSBA``, ``DynamicOptimizedTheta``). Much more accurate than ``medium_quality``, but takes longer to train.
      - ``"best_quality"``: Same models as in ``"high_quality"`, but performs validation with multiple backtests. Usually better than ``high_quality``, but takes even longer to train.
  
      Details for these presets can be found in ``autogluon/timeseries/configs/presets_configs.py``. If not
      provided, user-provided values for ``hyperparameters`` and ``hyperparameter_tune_kwargs`` will be used
      (defaulting to their default values specified below).
  hyperparameters : str or dict, optional
      Determines what models are trained and what hyperparameters are used by each model.
  
      If str is passed, will use a preset hyperparameter configuration defined in
      ``autogluon/timeseries/trainer/models/presets.py``. Supported values are ``"default"``, ``"light"`` and
      ``"very_light"``.
  
      If dict is provided, the keys are strings or types that indicate which models to train. Each value is
      itself a dict containing hyperparameters for each of the trained models, or a list of such dicts. Any
      omitted hyperparameters not specified here will be set to default. For example::
  
          predictor.fit(
              ...
              hyperparameters={
                  "DeepAR": {},
                  "Theta": [
                      {"decomposition_type": "additive"},
                      {"seasonal_period": 1},
                  ],
              }
          )
  
      The above example will train three models:
  
      * ``DeepAR`` with default hyperparameters
      * ``Theta`` with additive seasonal decomposition (all other parameters set to their defaults)
      * ``Theta`` with seasonality disabled (all other parameters set to their defaults)
  
      Full list of available models and their hyperparameters is provided in :ref:`Forecasting Time Series - Model Zoo <forecasting_model_zoo>`.
  
      The hyperparameters for each model can be fixed values (as shown above), or search spaces over which
      hyperparameter optimization is performed. A search space should only be provided when
      ``hyperparameter_tune_kwargs`` is given (i.e., hyperparameter-tuning is utilized). For example::
  
          from autogluon.common import space
  
          predictor.fit(
              ...
              hyperparameters={
                  "DeepAR": {
                      "hidden_size": space.Int(20, 100),
                      "dropout_rate": space.Categorical(0.1, 0.3),
                  },
              },
              hyperparameter_tune_kwargs="auto",
          )
  
      In the above example, multiple versions of the DeepAR model with different values of the parameters
      "hidden_size" and "dropout_rate" will be trained.
  hyperparameter_tune_kwargs : str or dict, optional
      Hyperparameter tuning strategy and kwargs (for example, how many HPO trials to run).
      If None, then hyperparameter tuning will not be performed.
  
      If type is ``str``, then this argument specifies a preset.
      Valid preset values:
  
      * "auto": Performs HPO via bayesian optimization search on GluonTS-backed neural forecasting models and
          random search on other models using local scheduler.
      * "random": Performs HPO via random search.
  
      You can also provide a dict to specify searchers and schedulers
      Valid keys:
  
      * "num_trials": How many HPO trials to run
      * "scheduler": Which scheduler to use. Valid values:
          * "local": Local shceduler that schedules trials FIFO
      * "searcher": Which searching algorithm to use. Valid values:
          * "local_random": Uses the "random" searcher
          * "random": Perform random search
          * "bayes": Perform HPO with HyperOpt on GluonTS-backed models via Ray tune. Perform random search on other models.
          * "auto": alias for "bayes"
  
      The "scheduler" and "searcher" key are required when providing a dict.
  
      Example::
  
          predictor.fit(
              ...
              hyperparameter_tune_kwargs={
                  "num_trials": 5,
                  "searcher": "auto",
                  "scheduler": "local",
              },
          )
  excluded_model_types: List[str], optional
      Banned subset of model types to avoid training during ``fit()``, even if present in ``hyperparameters``.
      For example, the following code will train all models included in the ``high_quality`` presets except ``DeepAR``::
  
          predictor.fit(
              ...,
              presets="high_quality",
              excluded_model_types=["DeepAR"],
          )
  num_val_windows : int, default = 1
      Number of backtests done on ``train_data`` for each trained model to estimate the validation performance.
      If ``num_val_windows > 1`` is provided, this value may be automatically reduced to ensure that the majority
      of time series in ``train_data`` are long enough for the chosen number of backtests.
  
      Increasing this parameter increases the training time roughly by a factor of ``num_val_windows // refit_every_n_windows``.
      See :attr:`refit_every_n_windows` and :attr:`val_step_size`: for details.
  
      For example, for ``prediction_length=2``, ``num_val_windows=3`` and ``val_step_size=1`` the folds are::
  
          |-------------------|
          | x x x x x y y - - |
          | x x x x x x y y - |
          | x x x x x x x y y |
  
      where ``x`` are the train time steps and ``y`` are the validation time steps.
  
      This argument has no effect if ``tuning_data`` is provided.
  val_step_size : int or None, default = None
      Step size between consecutive validation windows. If set to ``None``, defaults to ``prediction_length``
      provided when creating the predictor.
  
      This argument has no effect if ``tuning_data`` is provided.
  refit_every_n_windows: int or None, default = 1
      When performing cross validation, each model will be retrained every ``refit_every_n_windows`` validation
      windows. If set to ``None``, model will only be fit once for the first validation window.
  refit_full : bool, default = False
      If True, after training is complete, AutoGluon will attempt to re-train all models using all of training
      data (including the data initially reserved for validation). This argument has no effect if ``tuning_data``
      is provided.
  enable_ensemble : bool, default = True
      If True, the ``TimeSeriesPredictor`` will fit a simple weighted ensemble on top of the models specified via
      ``hyperparameters``.
  random_seed : int or None, default = 123
      If provided, fixes the seed of the random number generator for all models. This guarantees reproducible
      results for most models (except those trained on GPU because of the non-determinism of GPU operations).
  verbosity : int, optional
      If provided, overrides the ``verbosity`` value used when creating the ``TimeSeriesPredictor``. See
      documentation for :class:`~autogluon.timeseries.TimeSeriesPredictor` for more details.
docstr_tok: ["Fit","probabilistic","forecasting","models","to","the","given","time","series","dataset",".","Parameters","--","--","--","--","--","train_data",":","Union","[","TimeSeriesDataFrame",",","pd.DataFrame",",","str","]","Training","data","in","the",":","class",":","`","~autogluon.timeseries.TimeSeriesDataFrame","`","format",".","Time","series","with","length","``","<","=","(","num_val_windows","+","1",")","*","prediction_length","``","will","be","ignored","during","training",".","See",":","attr",":","`","num_val_windows","`","for","details",".","If","``","known_covariates_names","``","were","specified","when","creating","the","predictor",",","``","train_data","``","must","include","the","columns","listed","in","``","known_covariates_names","``","with","the","covariates","values","aligned","with","the","target","time","series",".","The","known","covariates","must","have","a","numeric","(","float","or","integer",")","dtype",".","Columns","of","``","train_data","``","except","``","target","``","and","those","listed","in","``","known_covariates_names","``","will","be","interpreted","as","``","past_covariates","``","-","covariates","that","are","known","only","in","the","past",".","If","``","train_data","``","has","static","features","(","i.e.",",","``","train_data.static_features","``","is","a","pandas","DataFrame",")",",","the","predictor","will","interpret","columns","with","``","int","``","and","``","float","``","dtypes","as","continuous","(","real-valued",")","features",",","columns","with","``","object","``","and","``","str","``","dtypes","as","categorical","features",",","and","will","ignore","the","rest","of","columns",".","For","example",",","to","ensure","that","column","``","store_id","''","with","dtype","``","int","``","is","interpreted","as","a","category",",","we","need","to","change","its","type","to","``","category","``",":",":","data.static_features","[","``","store_id","''","]","=","data.static_features","[","``","store_id","''","]",".astype","(","``","category","''",")","If","provided","data","is","an","instance","of","pandas","DataFrame",",","AutoGluon","will","attempt","to","automatically","convert","it","to","a","``","TimeSeriesDataFrame","``",".","tuning_data",":","Union","[","TimeSeriesDataFrame",",","pd.DataFrame",",","str","]",",","optional","Data","reserved","for","model","selection","and","hyperparameter","tuning",",","rather","than","training","individual","models",".","Also","used","to","compute","the","validation","scores",".","Note","that","only","the","last","``","prediction_length","``","time","steps","of","each","time","series","are","used","for","computing","the","validation","score",".","If","``","tuning_data","``","is","provided",",","multi-window","backtesting","on","training","data","will","be","disabled",",","the",":","attr",":","`","num_val_windows","`","will","be","set","to","``","0","``",",","and",":","attr",":","`","refit_full","`","will","be","set","to","``","False","``",".","Leaving","this","argument","empty","and","letting","AutoGluon","automatically","generate","the","validation","set","from","``","train_data","``","is","a","good","default",".","If","``","known_covariates_names","``","were","specified","when","creating","the","predictor",",","``","tuning_data","``","must","also","include","the","columns","listed","in","``","known_covariates_names","``","with","the","covariates","values","aligned","with","the","target","time","series",".","If","``","train_data","``","has","past","covariates","or","static","features",",","``","tuning_data","``","must","have","also","include","them","(","with","same","columns","names","and","dtypes",")",".","If","provided","data","is","an","instance","of","pandas","DataFrame",",","AutoGluon","will","attempt","to","automatically","convert","it","to","a","``","TimeSeriesDataFrame","``",".","time_limit",":","int",",","optional","Approximately","how","long",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.fit","`","will","run","(","wall-clock","time","in","seconds",")",".","If","not","specified",",",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.fit","`","will","run","until","all","models","have","completed","training",".","presets",":","str",",","optional","Optional","preset","configurations","for","various","arguments","in",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.fit","`",".","Can","significantly","impact","predictive","accuracy",",","memory","footprint",",","inference","latency","of","trained","models",",","and","various","other","properties","of","the","returned","predictor",".","It","is","recommended","to","specify","presets","and","avoid","specifying","most","other",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.fit","`","arguments","or","model","hyperparameters","prior","to","becoming","familiar","with","AutoGluon",".","For","example",",","set","``","presets=","''","high_quality","''","``","to","get","a","high-accuracy","predictor",",","or","set","``","presets=","''","fast_training","''","``","to","quickly","get","the","results",".","Any","user-specified","arguments","in",":","meth",":","`","~autogluon.timeseries.TimeSeriesPredictor.fit","`","will","override","the","values","used","by","presets",".","Available","presets",":","-","``","``","fast_training","''","``",":","fit","simple","statistical","models","(","``","ETS","``",",","``","Theta","``",",","``","Naive","``",",","``","SeasonalNaive","``",")","+","fast","tree-based","models","``","RecursiveTabular","``","and","``","DirectTabular","``",".","These","models","are","fast","to","train","but","may","not","be","very","accurate",".","-","``","``","medium_quality","''","``",":","all","models","mentioned","above","+","deep","learning","model","``","TemporalFusionTransformer","``",".","Default","setting","that","produces","good","forecasts","with","reasonable","training","time",".","-","``","``","high_quality","''","``",":","All","ML","models","available","in","AutoGluon","+","additional","statistical","models","(","``","NPTS","``",",","``","AutoETS","``",",","``","AutoARIMA","``",",","``","CrostonSBA","``",",","``","DynamicOptimizedTheta","``",")",".","Much","more","accurate","than","``","medium_quality","``",",","but","takes","longer","to","train",".","-","``","``","best_quality","''","``",":","Same","models","as","in","``","``","high_quality","''","`",",","but","performs","validation","with","multiple","backtests",".","Usually","better","than","``","high_quality","``",",","but","takes","even","longer","to","train",".","Details","for","these","presets","can","be","found","in","``","autogluon\/timeseries\/configs\/presets_configs.py","``",".","If","not","provided",",","user-provided","values","for","``","hyperparameters","``","and","``","hyperparameter_tune_kwargs","``","will","be","used","(","defaulting","to","their","default","values","specified","below",")",".","hyperparameters",":","str","or","dict",",","optional","Determines","what","models","are","trained","and","what","hyperparameters","are","used","by","each","model",".","If","str","is","passed",",","will","use","a","preset","hyperparameter","configuration","defined","in","``","autogluon\/timeseries\/trainer\/models\/presets.py","``",".","Supported","values","are","``","``","default","''","``",",","``","``","light","''","``","and","``","``","very_light","''","``",".","If","dict","is","provided",",","the","keys","are","strings","or","types","that","indicate","which","models","to","train",".","Each","value","is","itself","a","dict","containing","hyperparameters","for","each","of","the","trained","models",",","or","a","list","of","such","dicts",".","Any","omitted","hyperparameters","not","specified","here","will","be","set","to","default",".","For","example",":",":","predictor.fit","(","...","hyperparameters=","{","``","DeepAR","''",":","{","}",",","``","Theta","''",":","[","{","``","decomposition_type","''",":","``","additive","''","}",",","{","``","seasonal_period","''",":","1","}",",","]",",","}",")","The","above","example","will","train","three","models",":","*","``","DeepAR","``","with","default","hyperparameters","*","``","Theta","``","with","additive","seasonal","decomposition","(","all","other","parameters","set","to","their","defaults",")","*","``","Theta","``","with","seasonality","disabled","(","all","other","parameters","set","to","their","defaults",")","Full","list","of","available","models","and","their","hyperparameters","is","provided","in",":","ref",":","`","Forecasting","Time","Series","-","Model","Zoo","<","forecasting_model_zoo",">","`",".","The","hyperparameters","for","each","model","can","be","fixed","values","(","as","shown","above",")",",","or","search","spaces","over","which","hyperparameter","optimization","is","performed",".","A","search","space","should","only","be","provided","when","``","hyperparameter_tune_kwargs","``","is","given","(","i.e.",",","hyperparameter-tuning","is","utilized",")",".","For","example",":",":","from","autogluon.common","import","space","predictor.fit","(","...","hyperparameters=","{","``","DeepAR","''",":","{","``","hidden_size","''",":","space.Int","(","20",",","100",")",",","``","dropout_rate","''",":","space.Categorical","(","0.1",",","0.3",")",",","}",",","}",",","hyperparameter_tune_kwargs=","''","auto","''",",",")","In","the","above","example",",","multiple","versions","of","the","DeepAR","model","with","different","values","of","the","parameters","``","hidden_size","''","and","``","dropout_rate","''","will","be","trained",".","hyperparameter_tune_kwargs",":","str","or","dict",",","optional","Hyperparameter","tuning","strategy","and","kwargs","(","for","example",",","how","many","HPO","trials","to","run",")",".","If","None",",","then","hyperparameter","tuning","will","not","be","performed",".","If","type","is","``","str","``",",","then","this","argument","specifies","a","preset",".","Valid","preset","values",":","*","``","auto","''",":","Performs","HPO","via","bayesian","optimization","search","on","GluonTS-backed","neural","forecasting","models","and","random","search","on","other","models","using","local","scheduler",".","*","``","random","''",":","Performs","HPO","via","random","search",".","You","can","also","provide","a","dict","to","specify","searchers","and","schedulers","Valid","keys",":","*","``","num_trials","''",":","How","many","HPO","trials","to","run","*","``","scheduler","''",":","Which","scheduler","to","use",".","Valid","values",":","*","``","local","''",":","Local","shceduler","that","schedules","trials","FIFO","*","``","searcher","''",":","Which","searching","algorithm","to","use",".","Valid","values",":","*","``","local_random","''",":","Uses","the","``","random","''","searcher","*","``","random","''",":","Perform","random","search","*","``","bayes","''",":","Perform","HPO","with","HyperOpt","on","GluonTS-backed","models","via","Ray","tune",".","Perform","random","search","on","other","models",".","*","``","auto","''",":","alias","for","``","bayes","''","The","``","scheduler","''","and","``","searcher","''","key","are","required","when","providing","a","dict",".","Example",":",":","predictor.fit","(","...","hyperparameter_tune_kwargs=","{","``","num_trials","''",":","5",",","``","searcher","''",":","``","auto","''",",","``","scheduler","''",":","``","local","''",",","}",",",")","excluded_model_types",":","List","[","str","]",",","optional","Banned","subset","of","model","types","to","avoid","training","during","``","fit","(",")","``",",","even","if","present","in","``","hyperparameters","``",".","For","example",",","the","following","code","will","train","all","models","included","in","the","``","high_quality","``","presets","except","``","DeepAR","``",":",":","predictor.fit","(","...",",","presets=","''","high_quality","''",",","excluded_model_types=","[","``","DeepAR","''","]",",",")","num_val_windows",":","int",",","default","=","1","Number","of","backtests","done","on","``","train_data","``","for","each","trained","model","to","estimate","the","validation","performance",".","If","``","num_val_windows",">","1","``","is","provided",",","this","value","may","be","automatically","reduced","to","ensure","that","the","majority","of","time","series","in","``","train_data","``","are","long","enough","for","the","chosen","number","of","backtests",".","Increasing","this","parameter","increases","the","training","time","roughly","by","a","factor","of","``","num_val_windows","\/\/","refit_every_n_windows","``",".","See",":","attr",":","`","refit_every_n_windows","`","and",":","attr",":","`","val_step_size","`",":","for","details",".","For","example",",","for","``","prediction_length=2","``",",","``","num_val_windows=3","``","and","``","val_step_size=1","``","the","folds","are",":",":","|","--","--","--","--","--","--","--","--","--","-|","|","x","x","x","x","x","y","y","-","-","|","|","x","x","x","x","x","x","y","y","-","|","|","x","x","x","x","x","x","x","y","y","|","where","``","x","``","are","the","train","time","steps","and","``","y","``","are","the","validation","time","steps",".","This","argument","has","no","effect","if","``","tuning_data","``","is","provided",".","val_step_size",":","int","or","None",",","default","=","None","Step","size","between","consecutive","validation","windows",".","If","set","to","``","None","``",",","defaults","to","``","prediction_length","``","provided","when","creating","the","predictor",".","This","argument","has","no","effect","if","``","tuning_data","``","is","provided",".","refit_every_n_windows",":","int","or","None",",","default","=","1","When","performing","cross","validation",",","each","model","will","be","retrained","every","``","refit_every_n_windows","``","validation","windows",".","If","set","to","``","None","``",",","model","will","only","be","fit","once","for","the","first","validation","window",".","refit_full",":","bool",",","default","=","False","If","True",",","after","training","is","complete",",","AutoGluon","will","attempt","to","re-train","all","models","using","all","of","training","data","(","including","the","data","initially","reserved","for","validation",")",".","This","argument","has","no","effect","if","``","tuning_data","``","is","provided",".","enable_ensemble",":","bool",",","default","=","True","If","True",",","the","``","TimeSeriesPredictor","``","will","fit","a","simple","weighted","ensemble","on","top","of","the","models","specified","via","``","hyperparameters","``",".","random_seed",":","int","or","None",",","default","=","123","If","provided",",","fixes","the","seed","of","the","random","number","generator","for","all","models",".","This","guarantees","reproducible","results","for","most","models","(","except","those","trained","on","GPU","because","of","the","non-determinism","of","GPU","operations",")",".","verbosity",":","int",",","optional","If","provided",",","overrides","the","``","verbosity","``","value","used","when","creating","the","``","TimeSeriesPredictor","``",".","See","documentation","for",":","class",":","`","~autogluon.timeseries.TimeSeriesPredictor","`","for","more","details","."]
code: def fit(
      self,
      train_data: Union[TimeSeriesDataFrame, pd.DataFrame, str],
      tuning_data: Optional[
          Union[TimeSeriesDataFrame, pd.DataFrame, str]
      ] = None,
      time_limit: Optional[int] = None,
      presets: Optional[str] = None,
      hyperparameters: Dict[Union[str, Type], Any] = None,
      hyperparameter_tune_kwargs: Optional[Union[str, Dict]] = None,
      excluded_model_types: Optional[List[str]] = None,
      num_val_windows: int = 1,
      val_step_size: Optional[int] = None,
      refit_every_n_windows: int = 1,
      refit_full: bool = False,
      enable_ensemble: bool = True,
      random_seed: Optional[int] = 123,
      verbosity: Optional[int] = None,
  ) -> "TimeSeriesPredictor":
      """Fit probabilistic forecasting models to the given time series dataset.
  
      Parameters
      ----------
      train_data : Union[TimeSeriesDataFrame, pd.DataFrame, str]
          Training data in the :class:`~autogluon.timeseries.TimeSeriesDataFrame` format.
  
          Time series with length ``<= (num_val_windows + 1) * prediction_length`` will be ignored during training.
          See :attr:`num_val_windows` for details.
  
          If ``known_covariates_names`` were specified when creating the predictor, ``train_data`` must include the
          columns listed in ``known_covariates_names`` with the covariates values aligned with the target time series.
          The known covariates must have a numeric (float or integer) dtype.
  
          Columns of ``train_data`` except ``target`` and those listed in ``known_covariates_names`` will be
          interpreted as ``past_covariates`` - covariates that are known only in the past.
  
          If ``train_data`` has static features (i.e., ``train_data.static_features`` is a pandas DataFrame), the
          predictor will interpret columns with ``int`` and ``float`` dtypes as continuous (real-valued) features,
          columns with ``object`` and ``str`` dtypes as categorical features, and will ignore the rest of columns.
  
          For example, to ensure that column "store_id" with dtype ``int`` is interpreted as a category,
          we need to change its type to ``category``::
  
              data.static_features["store_id"] = data.static_features["store_id"].astype("category")
  
          If provided data is an instance of pandas DataFrame, AutoGluon will attempt to automatically convert it
          to a ``TimeSeriesDataFrame``.
  
      tuning_data : Union[TimeSeriesDataFrame, pd.DataFrame, str], optional
          Data reserved for model selection and hyperparameter tuning, rather than training individual models. Also
          used to compute the validation scores. Note that only the last ``prediction_length`` time steps of each
          time series are used for computing the validation score.
  
          If ``tuning_data`` is provided, multi-window backtesting on training data will be disabled, the
          :attr:`num_val_windows` will be set to ``0``, and :attr:`refit_full` will be set to ``False``.
  
          Leaving this argument empty and letting AutoGluon automatically generate the validation set from
          ``train_data`` is a good default.
  
          If ``known_covariates_names`` were specified when creating the predictor, ``tuning_data`` must also include
          the columns listed in ``known_covariates_names`` with the covariates values aligned with the target time
          series.
  
          If ``train_data`` has past covariates or static features, ``tuning_data`` must have also include them (with
          same columns names and dtypes).
  
          If provided data is an instance of pandas DataFrame, AutoGluon will attempt to automatically convert it
          to a ``TimeSeriesDataFrame``.
  
      time_limit : int, optional
          Approximately how long :meth:`~autogluon.timeseries.TimeSeriesPredictor.fit` will run (wall-clock time in
          seconds). If not specified, :meth:`~autogluon.timeseries.TimeSeriesPredictor.fit` will run until all models
          have completed training.
      presets : str, optional
          Optional preset configurations for various arguments in
          :meth:`~autogluon.timeseries.TimeSeriesPredictor.fit`.
  
          Can significantly impact predictive accuracy, memory footprint, inference latency of trained models,
          and various other properties of the returned predictor. It is recommended to specify presets and avoid
          specifying most other :meth:`~autogluon.timeseries.TimeSeriesPredictor.fit` arguments or model
          hyperparameters prior to becoming familiar with AutoGluon. For example, set ``presets="high_quality"``
          to get a high-accuracy predictor, or set ``presets="fast_training"`` to quickly get the results.
          Any user-specified arguments in :meth:`~autogluon.timeseries.TimeSeriesPredictor.fit` will
          override the values used by presets.
  
          Available presets:
  
          - ``"fast_training"``: fit simple statistical models (``ETS``, ``Theta``, ``Naive``, ``SeasonalNaive``) + fast tree-based models ``RecursiveTabular`` and ``DirectTabular``. These models are fast to train but may not be very accurate.
          - ``"medium_quality"``: all models mentioned above + deep learning model ``TemporalFusionTransformer``. Default setting that produces good forecasts with reasonable training time.
          - ``"high_quality"``: All ML models available in AutoGluon + additional statistical models (``NPTS``, ``AutoETS``, ``AutoARIMA``, ``CrostonSBA``, ``DynamicOptimizedTheta``). Much more accurate than ``medium_quality``, but takes longer to train.
          - ``"best_quality"``: Same models as in ``"high_quality"`, but performs validation with multiple backtests. Usually better than ``high_quality``, but takes even longer to train.
  
          Details for these presets can be found in ``autogluon/timeseries/configs/presets_configs.py``. If not
          provided, user-provided values for ``hyperparameters`` and ``hyperparameter_tune_kwargs`` will be used
          (defaulting to their default values specified below).
      hyperparameters : str or dict, optional
          Determines what models are trained and what hyperparameters are used by each model.
  
          If str is passed, will use a preset hyperparameter configuration defined in
          ``autogluon/timeseries/trainer/models/presets.py``. Supported values are ``"default"``, ``"light"`` and
          ``"very_light"``.
  
          If dict is provided, the keys are strings or types that indicate which models to train. Each value is
          itself a dict containing hyperparameters for each of the trained models, or a list of such dicts. Any
          omitted hyperparameters not specified here will be set to default. For example::
  
              predictor.fit(
                  ...
                  hyperparameters={
                      "DeepAR": {},
                      "Theta": [
                          {"decomposition_type": "additive"},
                          {"seasonal_period": 1},
                      ],
                  }
              )
  
          The above example will train three models:
  
          * ``DeepAR`` with default hyperparameters
          * ``Theta`` with additive seasonal decomposition (all other parameters set to their defaults)
          * ``Theta`` with seasonality disabled (all other parameters set to their defaults)
  
          Full list of available models and their hyperparameters is provided in :ref:`Forecasting Time Series - Model Zoo <forecasting_model_zoo>`.
  
          The hyperparameters for each model can be fixed values (as shown above), or search spaces over which
          hyperparameter optimization is performed. A search space should only be provided when
          ``hyperparameter_tune_kwargs`` is given (i.e., hyperparameter-tuning is utilized). For example::
  
              from autogluon.common import space
  
              predictor.fit(
                  ...
                  hyperparameters={
                      "DeepAR": {
                          "hidden_size": space.Int(20, 100),
                          "dropout_rate": space.Categorical(0.1, 0.3),
                      },
                  },
                  hyperparameter_tune_kwargs="auto",
              )
  
          In the above example, multiple versions of the DeepAR model with different values of the parameters
          "hidden_size" and "dropout_rate" will be trained.
      hyperparameter_tune_kwargs : str or dict, optional
          Hyperparameter tuning strategy and kwargs (for example, how many HPO trials to run).
          If None, then hyperparameter tuning will not be performed.
  
          If type is ``str``, then this argument specifies a preset.
          Valid preset values:
  
          * "auto": Performs HPO via bayesian optimization search on GluonTS-backed neural forecasting models and
              random search on other models using local scheduler.
          * "random": Performs HPO via random search.
  
          You can also provide a dict to specify searchers and schedulers
          Valid keys:
  
          * "num_trials": How many HPO trials to run
          * "scheduler": Which scheduler to use. Valid values:
              * "local": Local shceduler that schedules trials FIFO
          * "searcher": Which searching algorithm to use. Valid values:
              * "local_random": Uses the "random" searcher
              * "random": Perform random search
              * "bayes": Perform HPO with HyperOpt on GluonTS-backed models via Ray tune. Perform random search on other models.
              * "auto": alias for "bayes"
  
          The "scheduler" and "searcher" key are required when providing a dict.
  
          Example::
  
              predictor.fit(
                  ...
                  hyperparameter_tune_kwargs={
                      "num_trials": 5,
                      "searcher": "auto",
                      "scheduler": "local",
                  },
              )
      excluded_model_types: List[str], optional
          Banned subset of model types to avoid training during ``fit()``, even if present in ``hyperparameters``.
          For example, the following code will train all models included in the ``high_quality`` presets except ``DeepAR``::
  
              predictor.fit(
                  ...,
                  presets="high_quality",
                  excluded_model_types=["DeepAR"],
              )
      num_val_windows : int, default = 1
          Number of backtests done on ``train_data`` for each trained model to estimate the validation performance.
          If ``num_val_windows > 1`` is provided, this value may be automatically reduced to ensure that the majority
          of time series in ``train_data`` are long enough for the chosen number of backtests.
  
          Increasing this parameter increases the training time roughly by a factor of ``num_val_windows // refit_every_n_windows``.
          See :attr:`refit_every_n_windows` and :attr:`val_step_size`: for details.
  
          For example, for ``prediction_length=2``, ``num_val_windows=3`` and ``val_step_size=1`` the folds are::
  
              |-------------------|
              | x x x x x y y - - |
              | x x x x x x y y - |
              | x x x x x x x y y |
  
          where ``x`` are the train time steps and ``y`` are the validation time steps.
  
          This argument has no effect if ``tuning_data`` is provided.
      val_step_size : int or None, default = None
          Step size between consecutive validation windows. If set to ``None``, defaults to ``prediction_length``
          provided when creating the predictor.
  
          This argument has no effect if ``tuning_data`` is provided.
      refit_every_n_windows: int or None, default = 1
          When performing cross validation, each model will be retrained every ``refit_every_n_windows`` validation
          windows. If set to ``None``, model will only be fit once for the first validation window.
      refit_full : bool, default = False
          If True, after training is complete, AutoGluon will attempt to re-train all models using all of training
          data (including the data initially reserved for validation). This argument has no effect if ``tuning_data``
          is provided.
      enable_ensemble : bool, default = True
          If True, the ``TimeSeriesPredictor`` will fit a simple weighted ensemble on top of the models specified via
          ``hyperparameters``.
      random_seed : int or None, default = 123
          If provided, fixes the seed of the random number generator for all models. This guarantees reproducible
          results for most models (except those trained on GPU because of the non-determinism of GPU operations).
      verbosity : int, optional
          If provided, overrides the ``verbosity`` value used when creating the ``TimeSeriesPredictor``. See
          documentation for :class:`~autogluon.timeseries.TimeSeriesPredictor` for more details.
  
      """
      time_start = time.time()
      if self._learner.is_fit:
          raise AssertionError(
              "Predictor is already fit! To fit additional models create a new `Predictor`."
          )
  
      logger.info(
          "Beginning AutoGluon training..."
          + (f" Time limit = {time_limit}s" if time_limit else "")
      )
      logger.info(f"AutoGluon will save models to '{self.path}'")
      logger.info(
          get_ag_system_info(path=self.path, include_gpu_count=True)
      )
  
      if hyperparameters is None:
          hyperparameters = "default"
  
      if verbosity is None:
          verbosity = self.verbosity
      set_logger_verbosity(verbosity)
  
      fit_args = dict(
          prediction_length=self.prediction_length,
          target=self.target,
          known_covariates_names=self.known_covariates_names,
          eval_metric=self.eval_metric,
          eval_metric_seasonal_period=self.eval_metric_seasonal_period,
          quantile_levels=self.quantile_levels,
          freq=self.freq,
          time_limit=time_limit,
          hyperparameters=hyperparameters,
          hyperparameter_tune_kwargs=hyperparameter_tune_kwargs,
          excluded_model_types=excluded_model_types,
          num_val_windows=num_val_windows,
          val_step_size=val_step_size,
          refit_every_n_windows=refit_every_n_windows,
          refit_full=refit_full,
          enable_ensemble=enable_ensemble,
          random_seed=random_seed,
          verbosity=verbosity,
      )
      if presets is not None:
          logger.info(f"Setting presets to: {presets}")
      logger.info("\nFitting with arguments:")
      logger.info(
          f"{pprint.pformat({k: v for k, v in fit_args.items() if v is not None})}\n"
      )
  
      train_data = self._check_and_prepare_data_frame(
          train_data, name="train_data"
      )
      logger.info(
          f"Provided train_data has {self._get_dataset_stats(train_data)}"
      )
  
      if val_step_size is None:
          val_step_size = self.prediction_length
  
      if num_val_windows > 0:
          num_val_windows = self._reduce_num_val_windows_if_necessary(
              train_data,
              original_num_val_windows=num_val_windows,
              val_step_size=val_step_size,
          )
  
      if tuning_data is not None:
          tuning_data = self._check_and_prepare_data_frame(
              tuning_data, name="tuning_data"
          )
          self._check_data_for_evaluation(
              tuning_data, name="tuning_data"
          )
          logger.info(
              f"Provided tuning_data has {self._get_dataset_stats(train_data)}"
          )
          # TODO: Use num_val_windows to perform multi-window backtests on tuning_data
          if num_val_windows > 0:
              logger.warning(
                  "\tSetting num_val_windows = 0 (disabling backtesting on train_data) because tuning_data is provided."
              )
              num_val_windows = 0
  
      if num_val_windows == 0 and tuning_data is None:
          raise ValueError(
              "Please set num_val_windows >= 1 or provide custom tuning_data"
          )
  
      train_data = self._filter_short_series(
          train_data,
          num_val_windows=num_val_windows,
          val_step_size=val_step_size,
      )
  
      val_splitter = ExpandingWindowSplitter(
          prediction_length=self.prediction_length,
          num_val_windows=num_val_windows,
          val_step_size=val_step_size,
      )
  
      if random_seed is not None:
          seed_everything(random_seed)
  
      time_left = (
          None
          if time_limit is None
          else time_limit - (time.time() - time_start)
      )
      self._learner.fit(
          train_data=train_data,
          val_data=tuning_data,
          hyperparameters=hyperparameters,
          hyperparameter_tune_kwargs=hyperparameter_tune_kwargs,
          excluded_model_types=excluded_model_types,
          time_limit=time_left,
          verbosity=verbosity,
          val_splitter=val_splitter,
          refit_every_n_windows=refit_every_n_windows,
          enable_ensemble=enable_ensemble,
      )
      if refit_full:
          if tuning_data is None:
              self.refit_full()
          else:
              logger.warning(
                  "Skipping `refit_full` because custom `tuning_data` was provided during `fit`."
              )
  
      self.save()
      return self
  
imports: import json
  import logging
  import os
  import pprint
  import time
  from pathlib import Path
  from typing import Any, Dict, List, Optional, Tuple, Type, Union
  import pandas
  from autogluon.common.utils.deprecated_utils import Deprecated
  from autogluon.common.utils.log_utils import set_logger_verbosity
  from autogluon.common.utils.system_info import get_ag_system_info
  from autogluon.common.utils.utils import check_saved_predictor_version, seed_everything, setup_outputdir
  from autogluon.core.utils.decorators import apply_presets
  from autogluon.core.utils.loaders import load_pkl, load_str
  from autogluon.core.utils.savers import save_pkl, save_str
  from autogluon.timeseries import __version__
  from autogluon.timeseries.configs import TIMESERIES_PRESETS_CONFIGS
  from autogluon.timeseries.dataset.ts_dataframe import ITEMID, TimeSeriesDataFrame
  from autogluon.timeseries.learner import AbstractLearner, TimeSeriesLearner
  from autogluon.timeseries.metrics import TimeSeriesScorer, check_get_evaluation_metric
  from autogluon.timeseries.splitter import ExpandingWindowSplitter
  from autogluon.timeseries.trainer import AbstractTimeSeriesTrainer
label_desc: Use image node_id 9 for calling the TimeSeriesPredictor obj's underlying member method code with example usage: obj.fit(train_data, tuning_data, time_limit, presets, hyperparameters, hyperparameter_tune_kwargs, excluded_model_types, num_val_windows, val_step_size, refit_every_n_windows, refit_full, enable_ensemble, random_seed, verbosity) and returns: self