code: def compare_models(
      include: Optional[List[Union[str, Any]]] = None,
      exclude: Optional[List[str]] = None,
      fold: Optional[Union[int, Any]] = None,
      round: int = 4,
      cross_validation: bool = True,
      sort: str = "MASE",
      n_select: int = 1,
      budget_time: Optional[float] = None,
      turbo: bool = True,
      errors: str = "ignore",
      fit_kwargs: Optional[dict] = None,
      engine: Optional[Dict[str, str]] = None,
      verbose: bool = True,
      parallel: Optional[ParallelBackend] = None,
  ):
      """
      This function trains and evaluates performance of all estimators available in the
      model library using cross validation. The output of this function is a score grid
      with average cross validated scores. Metrics evaluated during CV can be accessed
      using the ``get_metrics`` function. Custom metrics can be added or removed using
      ``add_metric`` and ``remove_metric`` function.
  
  
      Example
      --------
      >>> from pycaret.datasets import get_data
      >>> airline = get_data('airline')
      >>> from pycaret.time_series import *
      >>> exp_name = setup(data = airline,  fh = 12)
      >>> best_model = compare_models()
  
  
      include: list of str or sktime compatible object, default = None
          To train and evaluate select models, list containing model ID or scikit-learn
          compatible object can be passed in include param. To see a list of all models
          available in the model library use the ``models`` function.
  
  
      exclude: list of str, default = None
          To omit certain models from training and evaluation, pass a list containing
          model id in the exclude parameter. To see a list of all models available
          in the model library use the ``models`` function.
  
  
      fold: int or scikit-learn compatible CV generator, default = None
          Controls cross-validation. If None, the CV generator in the ``fold_strategy``
          parameter of the ``setup`` function is used. When an integer is passed,
          it is interpreted as the 'n_splits' parameter of the CV generator in the
          ``setup`` function.
  
  
      round: int, default = 4
          Number of decimal places the metrics in the score grid will be rounded to.
  
  
      cross_validation: bool, default = True
          When set to False, metrics are evaluated on holdout set. ``fold`` param
          is ignored when cross_validation is set to False.
  
  
      sort: str, default = 'MASE'
          The sort order of the score grid. It also accepts custom metrics that are
          added through the ``add_metric`` function.
  
  
      n_select: int, default = 1
          Number of top_n models to return. For example, to select top 3 models use
          n_select = 3.
  
  
      budget_time: int or float, default = None
          If not None, will terminate execution of the function after budget_time
          minutes have passed and return results up to that point.
  
  
      turbo: bool, default = True
          When set to True, it excludes estimators with longer training times. To
          see which algorithms are excluded use the ``models`` function.
  
  
      errors: str, default = 'ignore'
          When set to 'ignore', will skip the model with exceptions and continue.
          If 'raise', will break the function when exceptions are raised.
  
  
      fit_kwargs: dict, default = {} (empty dict)
          Dictionary of arguments passed to the fit method of the model.
  
  
      engine: Optional[Dict[str, str]] = None
          The engine to use for the models, e.g. for auto_arima, users can
          switch between "pmdarima" and "statsforecast" by specifying
          engine={"auto_arima": "statsforecast"}
  
  
      verbose: bool, default = True
          Score grid is not printed when verbose is set to False.
  
  
      parallel: pycaret.internal.parallel.parallel_backend.ParallelBackend, default = None
          A ParallelBackend instance. For example if you have a SparkSession ``session``,
          you can use ``FugueBackend(session)`` to make this function running using
          Spark. For more details, see
          :class:`~pycaret.parallel.fugue_backend.FugueBackend`
  
  
      Returns:
          Trained model or list of trained models, depending on the ``n_select`` param.
  
  
      Warnings
      --------
      - Changing turbo parameter to False may result in very high training times.
  
      - No models are logged in ``MLflow`` when ``cross_validation`` parameter is False.
  
      """
  
      return _CURRENT_EXPERIMENT.compare_models(
          include=include,
          exclude=exclude,
          fold=fold,
          round=round,
          cross_validation=cross_validation,
          sort=sort,
          n_select=n_select,
          budget_time=budget_time,
          turbo=turbo,
          errors=errors,
          fit_kwargs=fit_kwargs,
          engine=engine,
          verbose=verbose,
          parallel=parallel,
      )
  
imports: import logging
  import os
  from typing import TYPE_CHECKING, Any, BinaryIO, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import pandas
  from pycaret.internal.parallel.parallel_backend import ParallelBackend
  from pycaret.time_series.forecasting.oop import TSForecastingExperiment
  from pycaret.utils.generic import check_if_global_is_not_none
label_desc: Use image node_id 2 for calling a global function with example usage: compare_models(include, exclude, fold, round, cross_validation, sort, n_select, budget_time, turbo, errors, fit_kwargs, engine, verbose, parallel) and returns: _CURRENT_EXPERIMENT