docstr: This function trains a Soft Voting / Majority Rule classifier for select
  models passed in the ``estimator_list`` param. The output of this function
  is a score grid with CV scores by fold. 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
  >>> juice = get_data('juice')
  >>> from pycaret.classification import *
  >>> exp_name = setup(data = juice,  target = 'Purchase')
  >>> top3 = compare_models(n_select = 3)
  >>> blender = blend_models(top3)
  
  
  estimator_list: list of scikit-learn compatible objects
      List of trained model objects
  
  
  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.
  
  
  choose_better: bool, default = False
      When set to True, the returned object is always better performing. The
      metric used for comparison is defined by the ``optimize`` parameter.
  
  
  optimize: str, default = 'Accuracy'
      Metric to compare for model selection when ``choose_better`` is True.
  
  
  method: str, default = 'auto'
      'hard' uses predicted class labels for majority rule voting. 'soft', predicts
      the class label based on the argmax of the sums of the predicted probabilities,
      which is recommended for an ensemble of well-calibrated classifiers. Default
      value, 'auto', will try to use 'soft' and fall back to 'hard' if the former is
      not supported.
  
  
  weights: list, default = None
      Sequence of weights (float or int) to weight the occurrences of predicted class
      labels (hard voting) or class probabilities before averaging (soft voting). Uses
      uniform weights when None.
  
  
  fit_kwargs: dict, default = {} (empty dict)
      Dictionary of arguments passed to the fit method of the model.
  
  
  groups: str or array-like, with shape (n_samples,), default = None
      Optional group labels when GroupKFold is used for the cross validation.
      It takes an array with shape (n_samples, ) where n_samples is the number
      of rows in training dataset. When string is passed, it is interpreted as
      the column name in the dataset containing group labels.
  
  
  probability_threshold: float, default = None
      Threshold for converting predicted probability to class label.
      It defaults to 0.5 for all classifiers unless explicitly defined
      in this parameter. Only applicable for binary classification.
  
  
  verbose: bool, default = True
      Score grid is not printed when verbose is set to False.
  
  
  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","trains","a","Soft","Voting","\/","Majority","Rule","classifier","for","select","models","passed","in","the","``","estimator_list","``","param",".","The","output","of","this","function","is","a","score","grid","with","CV","scores","by","fold",".","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",">",">",">","juice","=","get_data","(","'juice","'",")",">",">",">","from","pycaret.classification","import","*",">",">",">","exp_name","=","setup","(","data","=","juice",",","target","=","'Purchase","'",")",">",">",">","top3","=","compare_models","(","n_select","=","3",")",">",">",">","blender","=","blend_models","(","top3",")","estimator_list",":","list","of","scikit-learn","compatible","objects","List","of","trained","model","objects","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",".","choose_better",":","bool",",","default","=","False","When","set","to","True",",","the","returned","object","is","always","better","performing",".","The","metric","used","for","comparison","is","defined","by","the","``","optimize","``","parameter",".","optimize",":","str",",","default","=","'Accuracy'","Metric","to","compare","for","model","selection","when","``","choose_better","``","is","True",".","method",":","str",",","default","=","'auto'","'hard","'","uses","predicted","class","labels","for","majority","rule","voting",".","'soft","'",",","predicts","the","class","label","based","on","the","argmax","of","the","sums","of","the","predicted","probabilities",",","which","is","recommended","for","an","ensemble","of","well-calibrated","classifiers",".","Default","value",",","'auto","'",",","will","try","to","use","'soft","'","and","fall","back","to","'hard","'","if","the","former","is","not","supported",".","weights",":","list",",","default","=","None","Sequence","of","weights","(","float","or","int",")","to","weight","the","occurrences","of","predicted","class","labels","(","hard","voting",")","or","class","probabilities","before","averaging","(","soft","voting",")",".","Uses","uniform","weights","when","None",".","fit_kwargs",":","dict",",","default","=","{","}","(","empty","dict",")","Dictionary","of","arguments","passed","to","the","fit","method","of","the","model",".","groups",":","str","or","array-like",",","with","shape","(","n_samples",",",")",",","default","=","None","Optional","group","labels","when","GroupKFold","is","used","for","the","cross","validation",".","It","takes","an","array","with","shape","(","n_samples",",",")","where","n_samples","is","the","number","of","rows","in","training","dataset",".","When","string","is","passed",",","it","is","interpreted","as","the","column","name","in","the","dataset","containing","group","labels",".","probability_threshold",":","float",",","default","=","None","Threshold","for","converting","predicted","probability","to","class","label",".","It","defaults","to","0.5","for","all","classifiers","unless","explicitly","defined","in","this","parameter",".","Only","applicable","for","binary","classification",".","verbose",":","bool",",","default","=","True","Score","grid","is","not","printed","when","verbose","is","set","to","False",".","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 blend_models(
      self,
      estimator_list: list,
      fold: Optional[Union[int, Any]] = None,
      round: int = 4,
      choose_better: bool = False,
      optimize: str = "Accuracy",
      method: str = "auto",
      weights: Optional[List[float]] = None,
      fit_kwargs: Optional[dict] = None,
      groups: Optional[Union[str, Any]] = None,
      probability_threshold: Optional[float] = None,
      verbose: bool = True,
      return_train_score: bool = False,
  ) -> Any:
      """
      This function trains a Soft Voting / Majority Rule classifier for select
      models passed in the ``estimator_list`` param. The output of this function
      is a score grid with CV scores by fold. 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
      >>> juice = get_data('juice')
      >>> from pycaret.classification import *
      >>> exp_name = setup(data = juice,  target = 'Purchase')
      >>> top3 = compare_models(n_select = 3)
      >>> blender = blend_models(top3)
  
  
      estimator_list: list of scikit-learn compatible objects
          List of trained model objects
  
  
      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.
  
  
      choose_better: bool, default = False
          When set to True, the returned object is always better performing. The
          metric used for comparison is defined by the ``optimize`` parameter.
  
  
      optimize: str, default = 'Accuracy'
          Metric to compare for model selection when ``choose_better`` is True.
  
  
      method: str, default = 'auto'
          'hard' uses predicted class labels for majority rule voting. 'soft', predicts
          the class label based on the argmax of the sums of the predicted probabilities,
          which is recommended for an ensemble of well-calibrated classifiers. Default
          value, 'auto', will try to use 'soft' and fall back to 'hard' if the former is
          not supported.
  
  
      weights: list, default = None
          Sequence of weights (float or int) to weight the occurrences of predicted class
          labels (hard voting) or class probabilities before averaging (soft voting). Uses
          uniform weights when None.
  
  
      fit_kwargs: dict, default = {} (empty dict)
          Dictionary of arguments passed to the fit method of the model.
  
  
      groups: str or array-like, with shape (n_samples,), default = None
          Optional group labels when GroupKFold is used for the cross validation.
          It takes an array with shape (n_samples, ) where n_samples is the number
          of rows in training dataset. When string is passed, it is interpreted as
          the column name in the dataset containing group labels.
  
  
      probability_threshold: float, default = None
          Threshold for converting predicted probability to class label.
          It defaults to 0.5 for all classifiers unless explicitly defined
          in this parameter. Only applicable for binary classification.
  
  
      verbose: bool, default = True
          Score grid is not printed when verbose is set to False.
  
  
      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().blend_models(
          estimator_list=estimator_list,
          fold=fold,
          round=round,
          choose_better=choose_better,
          optimize=optimize,
          method=method,
          weights=weights,
          fit_kwargs=fit_kwargs,
          groups=groups,
          verbose=verbose,
          probability_threshold=probability_threshold,
          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 11 for calling the ClassificationExperiment obj's underlying member method code with example usage: obj.blend_models(estimator_list, fold, round, choose_better, optimize, method, weights, fit_kwargs, groups, probability_threshold, verbose, return_train_score) and returns: super