SelectFDR<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Filter

Select features using Benjamini-Hochberg False Discovery Rate control.

Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → SelectFDR<T>

Implements: ISupervisedFeatureSelector<T>

For Beginners

When testing many features, some will look significant by chance. FDR control says “among all the features we select, we want at most 5% (or your alpha) to be false positives.” This is less strict than FWER but more practical for high-dimensional data.

How It Works

Uses the Benjamini-Hochberg procedure to control the expected proportion of false discoveries among selected features. This provides more power than FWER control while still limiting false positives.

Constructors

Constructor Summary
SelectFDR(double alpha, Func<Matrix<T>, Vector<T>, ValueTuple<Vector<T>, Vector<T>>> scoreFunction) Creates a selector with a custom scorer, like scikit-learn’s score_func: it receives the data and the target and returns one score per feature (higher is better) and one p-value per feature.
SelectFDR(double alpha, SelectKBestScoreFunc scoreFunction, int[] columnIndices) Creates a selector that scores features with a built-in scikit-learn scoring function.

Properties

Property Summary
SelectKBestScoreFunc ScoreFunction { get; } Gets the built-in scoring function, used when no custom scorer was supplied.
Vector<T> AdjustedPValues { get; } Gets the Benjamini-Hochberg adjusted p-values after fitting.
Vector<T> PValues { get; } Gets the p-value of every feature after fitting.
Vector<T> Scores { get; } Gets the score of every feature after fitting.
bool SupportsInverseTransform { get; }
double Alpha { get; }
int[] SelectedIndices { get; }

Methods

Method Summary
Matrix<T> FitTransform(Matrix<T> data, Vector<T> target)
bool[] GetSupportMask()
string[] GetFeatureNamesOut(string[] inputFeatureNames)
void Fit(Matrix<T> data, Vector<T> target)