Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Feature selection

solow-feature-selection covers univariate selection with ANOVA F and mutual-information scoring, variance thresholding, recursive feature elimination, and sequential (forward or backward) selection around any ranker.

Univariate selection

SelectorWhat it does
VarianceThresholdDrop features with variance below a threshold (near-constant columns).
SelectKBestKeep the top k features under a caller scoring function.
SelectPercentileKeep the top p% of features.
SelectFprKeep features whose p-value is below alpha (false-positive rate control).
SelectFdrBenjamini-Hochberg false-discovery-rate control.
SelectFweBonferroni-corrected family-wise error control.

Scoring functions

FunctionWhat it does
score_f_classifANOVA F-statistic against class labels.
score_f_regressionCorrelation-derived F-statistic against a continuous target.

Multivariate selection

SelectorWhat it does
RfeGuyon-Weston-Barnhill-Vapnik (2002) recursive feature elimination around any caller-supplied ranker.
SequentialFeatureSelectorGreedy forward or backward selection with any scorer.

Example

#![allow(unused)]
fn main() {
use solow_feature_selection::{SelectKBest, score_f_classif};

let sel = SelectKBest::new(10).score_fn(score_f_classif).fit(&x, &y)?;
let x_kbest = sel.transform(&x)?;
Ok::<_, solow_core::Error>(())
}

References

  • Guyon, I., Weston, J., Barnhill, S., & Vapnik, V. (2002). Gene selection for cancer classification using support vector machines. Machine Learning 46, 389-422.