class_docstr: SelectBySingleFeaturePerformance() selects features based on the performance
  of a machine learning model trained utilising a single feature. In other
  words, it trains a machine learning model for every single feature, then determines
  each model's performance. If the performance of the model is greater than a user
  specified threshold, then the feature is retained, otherwise removed.
  
  The models are trained on each individual features using cross-validation.
  The performance metric to evaluate and the machine learning model to train are
  specified by the user.
  
  More details in the :ref:`User Guide <single_feat_performance>`.
  
  Parameters
  ----------
  {estimator}
  
  {variables}
  
  {scoring}
  
  {threshold}
  
  {cv}
  
  {confirm_variables}
  
  Attributes
  ----------
  {features_to_drop_}
  
  feature_performance_:
      Dictionary with the single feature model performance per feature.
  
  {variables_}
  
  {feature_names_in_}
  
  {n_features_in_}
  
  
  Methods
  -------
  {fit}
  
  {fit_transform}
  
  {get_support}
  
  {transform}
  
  References
  ----------
  Selection based on single feature performance was used in Credit Risk modelling as
  discussed in the following talk at PyData London 2017:
  
  .. [1] Galli S. "Machine Learning in Financial Risk Assessment".
      https://www.youtube.com/watch?v=KHGGlozsRtA
class_docstr_tok: ["SelectBySingleFeaturePerformance","(",")","selects","features","based","on","the","performance","of","a","machine","learning","model","trained","utilising","a","single","feature",".","In","other","words",",","it","trains","a","machine","learning","model","for","every","single","feature",",","then","determines","each","model","'s","performance",".","If","the","performance","of","the","model","is","greater","than","a","user","specified","threshold",",","then","the","feature","is","retained",",","otherwise","removed",".","The","models","are","trained","on","each","individual","features","using","cross-validation",".","The","performance","metric","to","evaluate","and","the","machine","learning","model","to","train","are","specified","by","the","user",".","More","details","in","the",":","ref",":","`","User","Guide","<","single_feat_performance",">","`",".","Parameters","--","--","--","--","--","{","estimator","}","{","variables","}","{","scoring","}","{","threshold","}","{","cv","}","{","confirm_variables","}","Attributes","--","--","--","--","--","{","features_to_drop_","}","feature_performance_",":","Dictionary","with","the","single","feature","model","performance","per","feature",".","{","variables_","}","{","feature_names_in_","}","{","n_features_in_","}","Methods","--","--","--","-","{","fit","}","{","fit_transform","}","{","get_support","}","{","transform","}","References","--","--","--","--","--","Selection","based","on","single","feature","performance","was","used","in","Credit","Risk","modelling","as","discussed","in","the","following","talk","at","PyData","London","2017",":","..","[","1","]","Galli","S.","``","Machine","Learning","in","Financial","Risk","Assessment","''",".","https",":","\/\/www.youtube.com\/watch","?","v=KHGGlozsRtA"]
docstr: Select features.
  
  Parameters
  ----------
  X: pandas dataframe of shape = [n_samples, n_features]
     The input dataframe
  
  y: array-like of shape (n_samples)
     Target variable. Required to train the estimator.
docstr_tok: ["Select","features",".","Parameters","--","--","--","--","--","X",":","pandas","dataframe","of","shape","=","[","n_samples",",","n_features","]","The","input","dataframe","y",":","array-like","of","shape","(","n_samples",")","Target","variable",".","Required","to","train","the","estimator","."]
code: def fit(self, X: pd.DataFrame, y: pd.Series):
      """
      Select features.
  
      Parameters
      ----------
      X: pandas dataframe of shape = [n_samples, n_features]
         The input dataframe
  
      y: array-like of shape (n_samples)
         Target variable. Required to train the estimator.
      """
  
      # check input dataframe
      X, y = check_X_y(X, y)
  
      # If required exclude variables that are not in the input dataframe
      self._confirm_variables(X)
  
      # find numerical variables or check variables entered by user
      self.variables_ = _find_or_check_numerical_variables(
          X, self.variables_
      )
  
      if len(self.variables_) == 1 and self.threshold is None:
          raise ValueError(
              "When evaluating a single feature you need to manually set a value "
              "for the threshold. "
              f"The transformer is evaluating the performance of {self.variables_} "
              f"and the threshold was left to {self.threshold} when initializing "
              f"the transformer."
          )
  
      self.feature_performance_ = {}
  
      # train a model for every feature and store the performance
      for feature in self.variables_:
          model = cross_validate(
              self.estimator,
              X[feature].to_frame(),
              y,
              cv=self.cv,
              return_estimator=False,
              scoring=self.scoring,
          )
  
          self.feature_performance_[feature] = model[
              "test_score"
          ].mean()
  
      # select features
      if not self.threshold:
          threshold = pd.Series(self.feature_performance_).mean()
      else:
          threshold = self.threshold
  
      self.features_to_drop_ = [
          f
          for f in self.feature_performance_.keys()
          if self.feature_performance_[f] < threshold
      ]
  
      # check we are not dropping all the columns in the df
      if len(self.features_to_drop_) == len(X.columns):
          warnings.warn(
              "All features will be dropped, try changing the threshold."
          )
  
      # save input features
      self._get_feature_names_in(X)
  
      return self
  
file_path: feature_engine/feature_engine/selection/single_feature_performance.py
imports: import warnings
  from typing import List, Union
  import pandas
  from sklearn.model_selection import cross_validate
  from feature_engine._docstrings.fit_attributes import _feature_names_in_docstring, _n_features_in_docstring
  from feature_engine._docstrings.methods import _fit_transform_docstring
  from feature_engine._docstrings.substitute import Substitution
  from feature_engine._variable_handling.init_parameter_checks import _check_init_parameter_variables
  from feature_engine._variable_handling.variable_type_selection import _find_or_check_numerical_variables
  from feature_engine.dataframe_checks import check_X_y
  from feature_engine.selection._docstring import _cv_docstring, _estimator_docstring, _features_to_drop_docstring, _fit_docstring, _get_support_docstring, _initial_model_performance_docstring, _scoring_docstring, _threshold_docstring, _transform_docstring, _variables_attribute_docstring, _variables_numerical_docstring
  from feature_engine.selection.base_selector import BaseSelector
  from feature_engine.tags import _return_tags
label_desc: Use image node_id 2 for calling the SelectBySingleFeaturePerformance obj's underlying member method code with example usage: obj.fit(X, y) and returns: self