class_docstr: Class for all standard transformation steps.
class_docstr_tok: ["Class","for","all","standard","transformation","steps","."]
docstr: Select relevant features.
docstr_tok: ["Select","relevant","features","."]
code: def _feature_selection(
      self,
      feature_selection_method,
      feature_selection_estimator,
      n_features_to_select,
  ):
      """Select relevant features."""
      self.logger.info("Set up feature selection.")
  
      if self._ml_usecase == MLUsecase.CLASSIFICATION:
          func = get_all_class_model_containers
      else:
          func = get_all_reg_model_containers
  
      models = {k: v for k, v in func(self).items() if not v.is_special}
      if isinstance(feature_selection_estimator, str):
          if feature_selection_estimator not in models:
              raise ValueError(
                  "Invalid value for the feature_selection_estimator "
                  f"parameter, got {feature_selection_estimator}. Allowed "
                  f"estimators are: {', '.join(models)}."
              )
          fs_estimator = models[feature_selection_estimator].class_def()
      elif not hasattr(feature_selection_estimator, "predict"):
          raise ValueError(
              "Invalid value for the feature_selection_estimator parameter. "
              "The provided estimator does not adhere to sklearn's API."
          )
      else:
          fs_estimator = feature_selection_estimator
  
      if 0 < n_features_to_select < 1:
          n_features_to_select = int(
              n_features_to_select * self.X.shape[1]
          )
      elif n_features_to_select > self.X.shape[1]:
          raise ValueError(
              "Invalid value for the n_features_to_select parameter. The number of "
              "feature to select should be less than the starting number of features."
          )
  
      if feature_selection_method.lower() == "univariate":
          if self._ml_usecase == MLUsecase.CLASSIFICATION:
              func = f_classif
          else:
              func = f_regression
          feature_selector = TransformerWrapper(
              transformer=SelectKBest(
                  score_func=func, k=n_features_to_select
              ),
              exclude=self._fxs["Keep"],
          )
      elif feature_selection_method.lower() == "classic":
          feature_selector = TransformerWrapper(
              transformer=SelectFromModel(
                  estimator=fs_estimator,
                  threshold=-np.inf,
                  max_features=n_features_to_select,
              ),
              exclude=self._fxs["Keep"],
          )
      elif feature_selection_method.lower() == "sequential":
          feature_selector = TransformerWrapper(
              transformer=SequentialFeatureSelector(
                  estimator=fs_estimator,
                  n_features_to_select=n_features_to_select,
                  n_jobs=self.n_jobs_param,
              ),
              exclude=self._fxs["Keep"],
          )
      else:
          raise ValueError(
              "Invalid value for the feature_selection_method parameter, "
              f"got {feature_selection_method}. Possible values are: "
              "'classic', 'univariate' or 'sequential'."
          )
  
      self.pipeline.steps.append(
          ("feature_selection", feature_selector)
      )
  
imports: from copy import deepcopy
  import numpy
  import pandas
  from category_encoders.basen import BaseNEncoder
  from category_encoders.one_hot import OneHotEncoder
  from category_encoders.ordinal import OrdinalEncoder
  from category_encoders.target_encoder import TargetEncoder
  from imblearn.combine import SMOTEENN, SMOTETomek
  from imblearn.over_sampling import ADASYN, SMOTE, SMOTEN, SMOTENC, SVMSMOTE, BorderlineSMOTE, KMeansSMOTE, RandomOverSampler
  from imblearn.under_sampling import AllKNN, CondensedNearestNeighbour, EditedNearestNeighbours, InstanceHardnessThreshold, NearMiss, NeighbourhoodCleaningRule, OneSidedSelection, RandomUnderSampler, RepeatedEditedNearestNeighbours, TomekLinks
  from sklearn.decomposition import PCA, IncrementalPCA, KernelPCA
  from sklearn.feature_selection import SelectFromModel, SelectKBest, SequentialFeatureSelector, VarianceThreshold, f_classif, f_regression
  from sklearn.impute import KNNImputer, SimpleImputer
  from sklearn.model_selection import GroupKFold, KFold, StratifiedKFold, TimeSeriesSplit, train_test_split
  from sklearn.preprocessing import KBinsDiscretizer, LabelEncoder, MaxAbsScaler, MinMaxScaler, PolynomialFeatures, PowerTransformer, QuantileTransformer, RobustScaler, StandardScaler
  from pycaret.containers.models.classification import get_all_model_containers
  from pycaret.containers.models.regression import get_all_model_containers
  from pycaret.internal.preprocess.iterative_imputer import IterativeImputer
  from pycaret.internal.preprocess.transformers import CleanColumnNames, DropImputer, EmbedTextFeatures, ExtractDateTimeFeatures, FixImbalancer, GroupFeatures, RareCategoryGrouping, RemoveMulticollinearity, RemoveOutliers, TargetTransformer, TransformerWrapper, TransformerWrapperWithInverse
  from pycaret.utils.constants import SEQUENCE
  from pycaret.utils.generic import MLUsecase, check_features_exist, df_shrink_dtypes, get_columns_to_stratify_by, normalize_custom_transformers, to_df, to_series
label_desc: Use image node_id 24 for calling the Preprocessor obj's underlying member method code with example usage: obj._feature_selection(feature_selection_method, feature_selection_estimator, n_features_to_select) without return types