docstr: 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
  >>> juice = get_data('juice')
  >>> from pycaret.classification import *
  >>> exp_name = setup(data = juice,  target = 'Purchase')
  >>> 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_auc_model = automl(optimize = 'AUC')
  
  
  optimize: str, default = 'Accuracy'
      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
docstr_tok: ["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",">",">",">","juice","=","get_data","(","'juice","'",")",">",">",">","from","pycaret.classification","import","*",">",">",">","exp_name","=","setup","(","data","=","juice",",","target","=","'Purchase","'",")",">",">",">","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_auc_model","=","automl","(","optimize","=","'AUC","'",")","optimize",":","str",",","default","=","'Accuracy'","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"]
code: def automl(
      self,
      optimize: str = "Accuracy",
      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
      >>> juice = get_data('juice')
      >>> from pycaret.classification import *
      >>> exp_name = setup(data = juice,  target = 'Purchase')
      >>> 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_auc_model = automl(optimize = 'AUC')
  
  
      optimize: str, default = 'Accuracy'
          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 super().automl(
          optimize=optimize,
          use_holdout=use_holdout,
          turbo=turbo,
          return_train_score=return_train_score,
      )
  
imports: import datetime
  import gc
  import logging
  import re
  import time
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  from unittest.mock import patch
  import numpy
  import pandas
  import plotly.express
  import sklearn
  from joblib.memory import Memory
  from scipy.optimize import shgo
  from pycaret.containers.metrics.classification import get_all_metric_containers
  from pycaret.containers.models.classification import ALL_ALLOWED_ENGINES, get_all_model_containers, get_container_default_engines
  from pycaret.internal.display import CommonDisplay
  from pycaret.internal.logging import get_logger
  from pycaret.internal.meta_estimators import CustomProbabilityThresholdClassifier, get_estimator_from_meta_estimator
  from pycaret.internal.parallel.parallel_backend import ParallelBackend
  from pycaret.internal.pipeline import Pipeline
  from pycaret.internal.preprocess.preprocessor import Preprocessor
  from pycaret.internal.pycaret_experiment.non_ts_supervised_experiment import _NonTSSupervisedExperiment
  from pycaret.internal.validation import is_sklearn_cv_generator
  from pycaret.loggers.base_logger import BaseLogger
  from pycaret.utils.constants import DATAFRAME_LIKE, SEQUENCE_LIKE, TARGET_LIKE
  from pycaret.utils.generic import MLUsecase, get_classification_task, get_label_encoder, highlight_setup
label_desc: Use image node_id 23 for calling the ClassificationExperiment obj's underlying member method code with example usage: obj.automl(optimize, use_holdout, turbo, return_train_score) and returns: super