Skip to main content

RFE

Recursive Feature Elimination: repeatedly fit an estimator and discard the weakest feature until the target count remains.

Algorithm

At each round the base estimator is refit on the surviving features and the one with the smallest absolute weight/importance is removed, yielding a ranking of all features.

Constructor

Skigen::RFE<Estimator> model(Estimator est, int n_features_to_select);

Parameters

ParameterDefaultDescription
estimatorEstimator exposing weights/importances.
n_features_to_selectNumber of features to keep.

Methods

MethodDescription
fit(X, y)Run the elimination loop.
transform(X)Project onto the selected features.
get_support_mask()Boolean mask of selected features.

Fitted Attributes

AccessorDescription
ranking()Elimination rank of each feature (1 = kept).

Example

Skigen::RFE rfe(Skigen::Ridge<double>(0.1), 3);
rfe.fit(X, y);
auto X_sel = rfe.transform(X);
Verified by unit tests

Covered by the module's CTest suite under tests/.

API Reference

For full signatures see the RFE API Reference.