SelectKBest<T>
Models & Types · AiDotNet.Preprocessing.FeatureSelection
Select K Best features using a pluggable scoring function.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → SelectKBest<T>
Implements: ISupervisedFeatureSelector<T>
For Beginners
This is a versatile “pick the best k features” tool. You provide a scoring function (like correlation, F-statistic, or mutual information), and it simply picks the top k scoring features. It’s scikit-learn compatible in concept.
How It Works
SelectKBest is a simple feature selector that computes a score for each feature using a provided scoring function and selects the k features with highest scores.
Constructors
| Constructor | Summary |
|---|---|
SelectKBest(int k, Func<Matrix<T>, Vector<T>, Vector<T>> scoreFunc, UnivariateScoreFunction defaultScoreFunc, int[] columnIndices) |
Properties
| Property | Summary |
|---|---|
Vector<T> PValues { get; } |
|
Vector<T> Scores { get; } |
|
bool SupportsInverseTransform { get; } |
|
int K { 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) |