class_docstr: Base class for BoostSearch meta-estimator.
  
  Warning: This class should not be used directly. Use derived classes
  instead.
class_docstr_tok: ["Base","class","for","BoostSearch","meta-estimator",".","Warning",":","This","class","should","not","be","used","directly",".","Use","derived","classes","instead","."]
docstr: Fit the provided boosting algorithm while searching the best subset
  of features (according to the selected strategy) and choosing the best
  parameters configuration (if provided).
  
  It takes the same arguments available in the estimator fit.
  
  Parameters
  ----------
  X : array-like of shape (n_samples, n_features)
      The training input samples.
  
  y : array-like of shape (n_samples,)
      Target values.
  
  trials : hyperopt.Trials() object, default=None
      A hyperopt trials object, used to store intermediate results for all
      optimization runs. Effective (and required) only when hyperopt
      parameter searching is computed.
  
  **fit_params : Additional fitting arguments.
  
  Returns
  -------
  self : object
docstr_tok: ["Fit","the","provided","boosting","algorithm","while","searching","the","best","subset","of","features","(","according","to","the","selected","strategy",")","and","choosing","the","best","parameters","configuration","(","if","provided",")",".","It","takes","the","same","arguments","available","in","the","estimator","fit",".","Parameters","--","--","--","--","--","X",":","array-like","of","shape","(","n_samples",",","n_features",")","The","training","input","samples",".","y",":","array-like","of","shape","(","n_samples",",",")","Target","values",".","trials",":","hyperopt.Trials","(",")","object",",","default=None","A","hyperopt","trials","object",",","used","to","store","intermediate","results","for","all","optimization","runs",".","Effective","(","and","required",")","only","when","hyperopt","parameter","searching","is","computed",".","*","*","fit_params",":","Additional","fitting","arguments",".","Returns","--","--","--","-","self",":","object"]
code: def fit(self, X, y, trials=None, **fit_params):
      """Fit the provided boosting algorithm while searching the best subset
      of features (according to the selected strategy) and choosing the best
      parameters configuration (if provided).
  
      It takes the same arguments available in the estimator fit.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features)
          The training input samples.
  
      y : array-like of shape (n_samples,)
          Target values.
  
      trials : hyperopt.Trials() object, default=None
          A hyperopt trials object, used to store intermediate results for all
          optimization runs. Effective (and required) only when hyperopt
          parameter searching is computed.
  
      **fit_params : Additional fitting arguments.
  
      Returns
      -------
      self : object
      """
  
      self.boost_type_ = _check_boosting(self.estimator)
  
      if self.param_grid is None:
          results = self._fit(X, y, fit_params)
  
          for v in vars(results["model"]):
              if v.endswith("_") and not v.startswith("__"):
                  setattr(
                      self, str(v), getattr(results["model"], str(v))
                  )
  
      else:
          self._validate_param_grid(fit_params)
  
          if self._tuning_type == "hyperopt":
              if trials is None:
                  raise ValueError(
                      "trials must be not None when using hyperopt."
                  )
  
              search = fmin(
                  fn=lambda p: self._fit(
                      params=p, X=X, y=y, fit_params=fit_params
                  ),
                  space=self._param_combi,
                  algo=tpe.suggest,
                  max_evals=self.n_iter,
                  trials=trials,
                  rstate=np.random.RandomState(self.sampling_seed),
                  show_progressbar=False,
                  verbose=0,
              )
              all_results = trials.results
  
          else:
              all_results = Parallel(
                  n_jobs=self.n_jobs,
                  verbose=self.verbose * int(bool(self.n_jobs)),
              )(
                  delayed(self._fit)(X, y, fit_params, params)
                  for params in self._param_combi
              )
  
          # extract results from parallel loops
          self.trials_, self.iterations_, self.scores_, models = (
              [],
              [],
              [],
              [],
          )
          for job_res in all_results:
              self.trials_.append(job_res["params"])
              self.iterations_.append(job_res["iterations"])
              self.scores_.append(self._score_sign * job_res["loss"])
              if isinstance(job_res["model"], _BoostSelector):
                  models.append(job_res["model"])
              else:
                  models.append(job_res["booster"])
  
          # get the best
          id_best = self._eval_score(self.scores_)
          self.best_params_ = self.trials_[id_best]
          self.best_iter_ = self.iterations_[id_best]
          self.best_score_ = self.scores_[id_best]
          self.estimator_ = models[id_best]
  
          for v in vars(models[id_best]):
              if v.endswith("_") and not v.startswith("__"):
                  setattr(
                      self, str(v), getattr(models[id_best], str(v))
                  )
  
      return self
  
imports: import io
  import contextlib
  import warnings
  import numpy
  import scipy
  from copy import deepcopy
  from sklearn.base import clone
  from sklearn.utils.validation import check_is_fitted
  from sklearn.base import BaseEstimator, TransformerMixin
  from joblib import Parallel, delayed
  from hyperopt import fmin, tpe
  from .utils import ParameterSampler, _check_param, _check_boosting
  from .utils import _set_categorical_indexes, _get_categorical_support
  from .utils import _feature_importances, _shap_importances
label_desc: Use image node_id 4 for calling the _BoostSearch obj's underlying member method code with example usage: obj.fit(X, y, trials) and returns: self