class_docstr: TimeSeriesLearner encompasses a full time series learning problem for a
  training run, and keeps track of datasets, features, and the trainer object.
class_docstr_tok: ["TimeSeriesLearner","encompasses","a","full","time","series","learning","problem","for","a","training","run",",","and","keeps","track","of","datasets",",","features",",","and","the","trainer","object","."]
code: def _fit(
      self,
      train_data: TimeSeriesDataFrame,
      val_data: Optional[TimeSeriesDataFrame] = None,
      hyperparameters: Union[str, Dict] = None,
      hyperparameter_tune_kwargs: Optional[Union[str, dict]] = None,
      time_limit: Optional[int] = None,
      val_splitter: Optional[AbstractWindowSplitter] = None,
      refit_every_n_windows: Optional[int] = 1,
      **kwargs,
  ) -> None:
      self._time_limit = time_limit
      time_start = time.time()
  
      train_data = self.feature_generator.fit_transform(
          train_data, data_frame_name="train_data"
      )
      if val_data is not None:
          val_data = self.feature_generator.transform(
              val_data, data_frame_name="tuning_data"
          )
  
      trainer_init_kwargs = kwargs.copy()
      trainer_init_kwargs.update(
          dict(
              path=self.model_context,
              prediction_length=self.prediction_length,
              eval_metric=self.eval_metric,
              eval_metric_seasonal_period=self.eval_metric_seasonal_period,
              target=self.target,
              quantile_levels=self.quantile_levels,
              verbosity=kwargs.get("verbosity", 2),
              enable_ensemble=kwargs.get("enable_ensemble", True),
              metadata=self.feature_generator.covariate_metadata,
              val_splitter=val_splitter,
              refit_every_n_windows=refit_every_n_windows,
              cache_predictions=self.cache_predictions,
          )
      )
      self.trainer = self.trainer_type(**trainer_init_kwargs)
      self.trainer_path = self.trainer.path
      self.save()
  
      logger.info(
          f"\nAutoGluon will gauge predictive performance using evaluation metric: '{self.eval_metric}'"
      )
      if not self.eval_metric.greater_is_better_internal:
          logger.info(
              "\tThis metric's sign has been flipped to adhere to being higher_is_better. The metric score can be multiplied by -1 to get the metric value."
          )
  
      logger.info("===================================================")
  
      self.trainer.fit(
          train_data=train_data,
          val_data=val_data,
          hyperparameters=hyperparameters,
          hyperparameter_tune_kwargs=hyperparameter_tune_kwargs,
          excluded_model_types=kwargs.get("excluded_model_types"),
          time_limit=time_limit,
      )
      self.save_trainer(trainer=self.trainer)
  
      self._time_fit_training = time.time() - time_start
  
imports: import logging
  import reprlib
  import time
  from typing import Any, Dict, List, Optional, Type, Union
  import pandas
  from autogluon.core.learner import AbstractLearner
  from autogluon.timeseries.dataset.ts_dataframe import TimeSeriesDataFrame
  from autogluon.timeseries.metrics import TimeSeriesScorer, check_get_evaluation_metric
  from autogluon.timeseries.models.abstract import AbstractTimeSeriesModel
  from autogluon.timeseries.splitter import AbstractWindowSplitter
  from autogluon.timeseries.trainer import AbstractTimeSeriesTrainer, AutoTimeSeriesTrainer
  from autogluon.timeseries.utils.features import TimeSeriesFeatureGenerator
  from autogluon.timeseries.utils.forecast import get_forecast_horizon_index_ts_dataframe
label_desc: Use image node_id 4 for calling the TimeSeriesLearner obj's underlying member method code with example usage: obj._fit(train_data, val_data, hyperparameters, hyperparameter_tune_kwargs, time_limit, val_splitter, refit_every_n_windows) without return types