Recursive Feature Elimination (RFE) is a wrapper-based feature selection algorithm that searches for an optimal subset of features by recursively considering smaller and smaller sets. The process begins by training an estimator on the initial set of features, obtaining a measure of importance for each one—either through coef_ or feature_importances_ attributes. The least important features are then pruned from the current set, and the procedure is recursively repeated on the remaining features until the desired number is reached.
Glossary
Recursive Feature Elimination (RFE)

What is Recursive Feature Elimination (RFE)?
A backward feature selection algorithm that iteratively trains a model, ranks features by importance, and prunes the least significant ones to find an optimal predictive subset.
The estimator used within the RFE core must expose feature importance scores; support vector machines with linear kernels and random forests are common choices. A critical variant, RFECV, integrates cross-validation into the loop to automatically determine the optimal number of features by selecting the subset size that minimizes the validation error, eliminating the need to manually specify the final feature count.
Key Characteristics of RFE
Recursive Feature Elimination (RFE) is a greedy optimization algorithm that searches for the optimal subset of features by iteratively training a model and pruning the weakest performers.
Backward Elimination Core Loop
RFE operates through a recursive pruning process that systematically removes the least informative features. The algorithm:
- Trains the chosen estimator on the current feature set
- Ranks features by importance via coefficient weights or feature importance scores
- Eliminates the lowest-ranked feature or a specified step size of features
- Repeats on the reduced set until the desired number of features remains This wrapper approach evaluates feature subsets in the context of the specific model, capturing feature interactions that filter methods miss.
Model-Dependent Ranking Criterion
The elimination order depends entirely on the base estimator's intrinsic importance metric:
- Linear models: Absolute coefficient magnitudes (|w_i|) from
coef_ - Tree-based models: Gini importance or mean decrease in impurity from
feature_importances_ - SVM with linear kernel: Squared coefficient weights from the separating hyperplane
- Any model with a
coef_orfeature_importances_attribute can serve as the RFE estimator This tight coupling means RFE inherits the biases of the underlying model—a linear estimator will miss non-linear relationships.
Cross-Validated Variant (RFECV)
RFECV extends standard RFE by automatically determining the optimal number of features through cross-validation:
- Performs RFE to generate ranked feature subsets of all possible sizes
- Evaluates each subset size using k-fold cross-validation on the training data
- Selects the smallest feature set within one standard error of the peak performance score
- Eliminates the need to manually specify
n_features_to_selectThis variant guards against overfitting by balancing predictive performance with model parsimony, making it essential for high-dimensional biomarker discovery.
Step Size and Computational Trade-offs
The step parameter controls how many features are removed per iteration, creating a speed-accuracy trade-off:
- step=1: Exhaustive search removing one feature at a time—most precise but computationally expensive for high-dimensional data (O(n_features²) model fits)
- step > 1: Removes multiple features per iteration—faster but risks eliminating correlated features that are individually weak but jointly informative
- step as float (0.0–1.0): Removes a percentage of remaining features per iteration, accelerating convergence on wide datasets For genomic datasets with 10,000+ features, a larger step size or a pre-filtering stage is often necessary.
Correlated Feature Instability
RFE exhibits selection instability when features are highly correlated, a common scenario in biomarker identification:
- Two perfectly correlated predictors will have arbitrary ranking order, as removing one leaves the other to capture the full effect
- Small data perturbations can cause dramatic reordering of correlated feature groups
- The final subset may exclude biologically relevant markers simply because a correlated proxy was retained Mitigation strategies include using stability selection wrappers, applying RFECV with multiple random seeds, or pre-clustering correlated features before elimination.
Practical Implementation in scikit-learn
The sklearn.feature_selection module provides two primary classes:
RFE(estimator, n_features_to_select): Basic recursive elimination with manual specification of the target feature countRFECV(estimator, cv, scoring): Cross-validated variant that automatically selects the optimal subset size Key attributes after fitting include:ranking_: Integer rank for each feature (1 = selected, higher = eliminated earlier)support_: Boolean mask of selected featuresgrid_scores_(RFECV only): Cross-validation scores for each subset size For biomarker discovery workflows, RFECV with a linear SVM or random forest is a common starting point.
Frequently Asked Questions
Clear, technically precise answers to the most common questions about implementing and interpreting Recursive Feature Elimination for high-dimensional biomarker discovery.
Recursive Feature Elimination (RFE) is a wrapper-type feature selection algorithm that iteratively removes the least important features from a dataset to identify the optimal subset for a given predictive model. The algorithm operates by first training an estimator—such as a support vector machine, random forest, or logistic regression model—on the full feature set. It then ranks features by their importance scores, which are derived from coefficient magnitudes in linear models or Gini importance in tree-based models. At each iteration, the least important feature or a predefined step size of features is pruned. The model is retrained on the reduced feature set, and the process repeats recursively until the desired number of features remains. The final output is a ranked list of all features and a selected subset that maximizes cross-validated performance. Unlike filter methods that evaluate features independently of the model, RFE's wrapper approach captures feature interactions and multivariate effects, making it particularly effective for biomarker panels where synergistic relationships between analytes matter. However, this model-dependence also means RFE is computationally expensive, scaling with O(n_features * model_training_time), and the selected subset is specific to the estimator used.
RFE vs. Other Feature Selection Methods
A systematic comparison of Recursive Feature Elimination against widely used alternative feature selection techniques for high-dimensional biomarker data.
| Feature | RFE | LASSO (L1) | Boruta | mRMR |
|---|---|---|---|---|
Selection Approach | Wrapper (model-dependent) | Embedded (regularization) | Wrapper (ensemble-based) | Filter (information theory) |
Handles Multicollinearity | Moderate (ranks correlated features) | Selects one, zeros others | Explicitly minimizes redundancy | |
Provides Feature Rankings | By coefficient magnitude | By relevance-redundancy score | ||
Computational Cost (p=10,000) | High (O(p²) worst case) | Low (convex optimization) | Very High (shadow features) | Low (pairwise mutual info) |
Optimal Subset Guarantee | Sparse solution (convex) | All-relevant set | Ranked list, no subset | |
Model Agnostic | Yes (any importance scorer) | Linear models only | Random forest only | |
Typical Use Case | Small-n, large-p biomarker discovery | Sparse linear biomarker panels | Confirming all relevant biomarkers | Pre-filtering for downstream models |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
RFE is one of many strategies for reducing dimensionality in high-dimensional biomarker data. These related methods span wrapper, filter, embedded, and causal approaches.
LASSO (L1 Regularization)
An embedded method that performs feature selection and regularization simultaneously by adding a penalty equal to the absolute value of coefficient magnitudes. Unlike RFE, LASSO shrinks irrelevant coefficients to exactly zero during model fitting rather than iteratively removing them.
- Produces a sparse model in a single training run
- Handles the p > n problem common in genomics
- Selection is tied to the linear model's objective function
Boruta
An all-relevant wrapper method that extends random forest importance scores by comparing real features against randomly shuffled shadow features. Unlike RFE's greedy elimination, Boruta identifies all features with any meaningful relationship to the target.
- Creates shadow attributes as null distribution baselines
- Iteratively removes features confirmed irrelevant
- Captures non-linear interactions that linear RFE may miss
Stability Selection
A robust framework that applies a selection algorithm like LASSO to many random subsamples of the data and retains features consistently chosen across perturbations. Addresses RFE's sensitivity to small data fluctuations.
- Controls the expected number of false positives
- Provides a selection probability per feature rather than a binary decision
- Particularly valuable for biomarker discovery where reproducibility is critical
SHAP Feature Selection
A model-agnostic approach that uses Shapley additive explanations to quantify each feature's marginal contribution to predictions. Unlike RFE's reliance on internal model weights, SHAP values provide consistent importance measures across any model type.
- Based on cooperative game theory principles
- Handles feature interactions transparently
- Works with tree ensembles, neural networks, and kernel methods
Markov Blanket Selection
A causal feature selection method that identifies the minimal set of variables making the target conditionally independent of all others. This set includes direct causes, effects, and confounders—providing stronger guarantees than RFE's correlational approach.
- Discovers the true causal neighborhood of the target
- Eliminates redundant but non-causal predictors
- Uses conditional independence tests rather than model importance scores
Knockoff Filter
A statistical framework for controlled variable selection that creates synthetic 'knockoff' variables mimicking the original features' correlation structure. These serve as negative controls, enabling rigorous false discovery rate estimation that RFE cannot provide.
- Guarantees exact FDR control under minimal assumptions
- Constructs paired null variables for each real feature
- Widely adopted in genome-wide association studies

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us