Welcome to dRFEtools’s documentation!¶
dRFEtools is a package for dynamic recursive feature elimination with
scikit-learn.
Package Information¶
dRFEtools is developed in Python 3.11+.
In addition to scikit-learn, dRFEtools is also built with:
NumPy
SciPy
Pandas
matplotlib
plotnine
statsmodels
Currently, dynamic RFE supports models with coef_ or feature_importances_ attribute.
Features¶
This package provides several functions to run dynamic recursive feature elimination (dRFE) for random forest and linear model classifier and regression models.
- Random Forest Models:
Assume Out-of-Bag (OOB) scoring is enabled.
- Linear Models:
Build an internal developmental split.
Measurements for Feature Selection¶
Classification:
Normalized mutual information
Accuracy
Area under the curve (AUC) ROC curve
Regression:
R2 (can be negative if model is arbitrarily worse)
Explained variance
Mean squared error
Package Structure¶
The codebase is organized into focused modules:
dRFEtools.py– core interfaces for random-forest and developmental-set elimination workflows.scoring/– metric implementations for developmental splits and random-forest OOB scoring.lowess/– helpers for smoothing elimination curves and extracting optimal feature counts.metrics/– feature ranking utilities used during elimination.plotting.py– visualization helpers re-exported from the top-level package.cli.py– command-line entry points for running full dRFE pipelines.utils.py– shared helpers for normalizing results and persisting plots.
API Overview¶
rf_rfe and dev_rfe return standardized dictionaries for each iteration
that include the number of retained features, a task-specific metrics
mapping, and the indices of surviving features. The same format is consumed by
the plotting, LOWESS, and scoring helpers documented in the reference manual
below, and is reflected throughout the tutorials for the 0.4.x release.
Table of Contents