code: def automl(
      optimize: str = "R2",
      use_holdout: bool = False,
      turbo: bool = True,
      return_train_score: bool = False,
  ) -> Any:
      """
      This function returns the best model out of all trained models in
      current session based on the ``optimize`` parameter. Metrics
      evaluated can be accessed using the ``get_metrics`` function.
  
  
      Example
      -------
      >>> from pycaret.datasets import get_data
      >>> boston = get_data('boston')
      >>> from pycaret.regression import *
      >>> exp_name = setup(data = boston,  target = 'medv')
      >>> top3 = compare_models(n_select = 3)
      >>> tuned_top3 = [tune_model(i) for i in top3]
      >>> blender = blend_models(tuned_top3)
      >>> stacker = stack_models(tuned_top3)
      >>> best_mae_model = automl(optimize = 'MAE')
  
  
      optimize: str, default = 'R2'
          Metric to use for model selection. It also accepts custom metrics
          added using the ``add_metric`` function.
  
  
      use_holdout: bool, default = False
          When set to True, metrics are evaluated on holdout set instead of CV.
  
  
      turbo: bool, default = True
          When set to True and use_holdout is False, only models created with default fold
          parameter will be considered. If set to False, models created with a non-default
          fold parameter will be scored again using default fold settings, so that they can be
          compared.
  
  
      return_train_score: bool, default = False
          If False, returns the CV Validation scores only.
          If True, returns the CV training scores along with the CV validation scores.
          This is useful when the user wants to do bias-variance tradeoff. A high CV
          training score with a low corresponding CV validation score indicates overfitting.
  
  
      Returns:
          Trained Model
  
  
      """
  
      return _CURRENT_EXPERIMENT.automl(
          optimize=optimize,
          use_holdout=use_holdout,
          turbo=turbo,
          return_train_score=return_train_score,
      )
  
imports: import logging
  import os
  from typing import Any, BinaryIO, Callable, Dict, List, Optional, Union
  import pandas
  from joblib.memory import Memory
  from pycaret.internal.parallel.parallel_backend import ParallelBackend
  from pycaret.loggers.base_logger import BaseLogger
  from pycaret.regression.oop import RegressionExperiment
  from pycaret.utils.constants import DATAFRAME_LIKE, SEQUENCE_LIKE, TARGET_LIKE
  from pycaret.utils.generic import check_if_global_is_not_none
label_desc: Use image node_id 18 for calling a global function with example usage: automl(optimize, use_holdout, turbo, return_train_score) and returns: _CURRENT_EXPERIMENT