SelectFpr<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Filter.Univariate

Selects features based on a false positive rate test.

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

Implements: ISupervisedFeatureSelector<T>

For Beginners

This selector uses statistical significance:

  • Computes a p-value for each feature (how likely it’s just noise)
  • Keeps features with p-value below alpha (threshold)
  • Lower alpha = stricter selection = fewer false positives

How It Works

SelectFpr selects features whose p-value is below a threshold (alpha). This controls the expected percentage of false positives among all features.

For example, with alpha=0.05, we expect about 5% of the selected features to be false positives (features that passed the test by chance).

Constructors

Constructor Summary
SelectFpr(double alpha, SelectKBestScoreFunc scoringFunction, int[] columnIndices) Creates a new instance of SelectFpr.

Properties

Property Summary
SelectKBestScoreFunc ScoringFunction { get; } Gets the scoring function used.
Vector<T> PValues { get; } Gets the p-values for each feature.
Vector<T> Scores { get; } Gets the scores for each feature.
bool SupportsInverseTransform { get; } Gets whether this transformer supports inverse transformation.
double Alpha { get; } Gets the significance level (alpha).
int[] SelectedIndices { get; } Gets the indices of selected features.

Methods

Method Summary
Matrix<T> FitTransform(Matrix<T> data, Vector<T> target) Fits and transforms the data.
bool[] GetSupportMask() Gets the support mask indicating which features are selected.
string[] GetFeatureNamesOut(string[] inputFeatureNames) Gets the output feature names after transformation.
void Fit(Matrix<T> data, Vector<T> target) Fits the selector by computing p-values.