SelectFPR<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Filter

Select features based on False Positive Rate threshold.

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

Implements: ISupervisedFeatureSelector<T>

For Beginners

This method uses statistical testing to find features that are unlikely to be uninformative by chance. If you set alpha=0.05, it keeps features where there’s less than 5% chance the feature-target relationship is random. However, when testing many features, some false positives slip through.

How It Works

Selects features with p-values below a specified alpha threshold. Does not control for multiple testing, so at alpha=0.05, approximately 5% of null (non-informative) features will be incorrectly selected.

Constructors

Constructor Summary
SelectFPR(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.
SelectFPR(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> 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)