GenericUnivariateSelect<T>

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

Generic univariate feature selector with configurable mode.

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

Implements: ISupervisedFeatureSelector<T>

For Beginners

This is a “swiss army knife” selector:

  • k_best: Select exactly k features
  • percentile: Select top X% of features
  • fpr: Select based on false positive rate
  • fdr: Select based on false discovery rate
  • fwe: Select based on family-wise error rate

How It Works

GenericUnivariateSelect provides a unified interface to all univariate feature selection methods. You can choose between k_best, percentile, fpr, fdr, and fwe modes.

This is useful when you want to experiment with different selection strategies without changing your code structure.

Constructors

Constructor Summary
GenericUnivariateSelect(UnivariateSelectMode mode, object param, SelectKBestScoreFunc scoringFunction, int[] columnIndices) Creates a new instance of GenericUnivariateSelect.

Properties

Property Summary
SelectKBestScoreFunc ScoringFunction { get; } Gets the scoring function used.
UnivariateSelectMode Mode { get; } Gets the selection mode.
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.
int[] SelectedIndices { get; } Gets the indices of selected features.
object Param { get; } Gets the mode parameter (k, percentile, or alpha depending on mode).

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 scores and selecting features.