Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Seyamalam/bun-scikit/llms.txt
Use this file to discover all available pages before exploring further.
Overview
RFE (Recursive Feature Elimination) selects features by recursively considering smaller sets of features. It trains a model, ranks features by importance, removes the least important features, and repeats until the desired number of features is reached.Constructor
Parameters
Base estimator that exposes feature importance (e.g., via
coef_ or featureImportances_).Number of features to select. If null, selects half of the features.
Number or proportion of features to remove at each iteration.
If integer ≥ 1, removes that many features.
If float in (0, 1), removes that proportion of remaining features.
Methods
fit()
Training data matrix.
Target values.
transform()
Data to transform.
fitTransform()
Properties
Boolean mask of selected features.
Feature ranking (1 = selected, higher values eliminated earlier).
Number of selected features.
The fitted estimator used for feature ranking.
Examples
Basic RFE with LinearRegression
RFE with RandomForest
Use in pipeline
Stepwise elimination
Notes
- RFE is a wrapper method that requires training the model multiple times
- Computationally expensive for large datasets or complex models
- Works best with models that provide feature importance or coefficients
- Common base estimators: LinearRegression, LogisticRegression, SVC (linear), RandomForest
- Consider RFECV (with cross-validation) for automatic feature number selection