code: def rfecv_search(model, algo):
      r"""Return the best feature set using recursive feature elimination
      with cross-validation.
  
      Parameters
      ----------
      model : alphapy.Model
          The model object with RFE parameters.
      algo : str
          Abbreviation of the algorithm to run.
  
      Returns
      -------
      model : alphapy.Model
          The model object with the RFE support vector and the best
          estimator.
  
      Notes
      -----
      If a scoring function is available, then AlphaPy can perform RFE
      with Cross-Validation (CV), as in this function; otherwise, it just
      does RFE without CV.
  
      References
      ----------
      For more information about Recursive Feature Elimination,
      refer to [RFECV]_.
  
      .. [RFECV] http://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.RFECV.html
  
      """
  
      # Extract model data.
  
      X_train = model.X_train
      y_train = model.y_train
  
      # Extract model parameters.
  
      cv_folds = model.specs["cv_folds"]
      n_jobs = model.specs["n_jobs"]
      rfe_step = model.specs["rfe_step"]
      scorer = model.specs["scorer"]
      verbosity = model.specs["verbosity"]
      estimator = model.estimators[algo]
  
      # Perform Recursive Feature Elimination
  
      logger.info("Recursive Feature Elimination with CV")
      rfecv = RFECV(
          estimator,
          step=rfe_step,
          cv=cv_folds,
          scoring=scorer,
          verbose=verbosity,
          n_jobs=n_jobs,
      )
      start = time()
      selector = rfecv.fit(X_train, y_train)
      logger.info(
          "RFECV took %.2f seconds for step %d and %d folds",
          (time() - start),
          rfe_step,
          cv_folds,
      )
      logger.info(
          "Algorithm: %s, Selected Features: %d, Ranking: %s",
          algo,
          selector.n_features_,
          selector.ranking_,
      )
  
      # Record the new estimator, support vector, feature names, and importances
  
      best_estimator = selector.estimator_
      model.estimators[algo] = best_estimator
      model.support[algo] = selector.support_
      model.fnames_algo[algo] = list(
          itertools.compress(model.fnames_algo[algo], selector.support_)
      )
      if hasattr(best_estimator, "feature_importances_"):
          model.importances[algo] = best_estimator.feature_importances_
  
      # Return the model with the support vector
  
      return model
  
file_path: AlphaPy/alphapy/optimize.py
imports: from alphapy.globals import ModelType
  from datetime import datetime
  import itertools
  import logging
  import numpy
  from sklearn.feature_selection import RFECV
  from sklearn.feature_selection import SelectPercentile
  from sklearn.model_selection import GridSearchCV
  from sklearn.model_selection import RandomizedSearchCV
  from sklearn.pipeline import Pipeline
  from time import time
label_desc: Use image node_id 1 for calling a global function with example usage: rfecv_search(model, algo) and returns: model