Skip to main content

SelectFromModel

A meta-transformer that selects features by thresholding the coef_ or feature_importances_ of a wrapped estimator.

Algorithm​

Fits the base estimator, then keeps features whose importance exceeds a threshold (mean, median, or a numeric value).

Constructor​

Skigen::SelectFromModel<Estimator> model(Estimator est, Threshold = Mean);

Parameters​

ParameterDefaultDescription
estimator—Estimator exposing coefficients/importances.
thresholdMeanMean, Median, or a numeric cutoff.

Methods​

MethodDescription
fit(X, y)Fit the base estimator and compute the mask.
transform(X)Keep features above the threshold.
get_support_mask()Boolean mask of selected features.

Fitted Attributes​

AccessorDescription
estimator()The fitted base estimator.

Example​

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

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

API Reference

For full signatures see the SelectFromModel API Reference.