SequentialFeatureSelector<T>
Models & Types · AiDotNet.Preprocessing.FeatureSelection.Wrapper
Sequential Feature Selector using greedy forward or backward selection.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → SequentialFeatureSelector<T>
Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>
For Beginners
Think of forward selection like building a team: you start with no players and add the best candidate one at a time until you have enough. Backward selection is the opposite: start with everyone and cut the worst performer one at a time. The “best” is determined by how well a model performs with those features.
How It Works
Sequential Feature Selection (SFS) is a wrapper method that evaluates feature subsets using a model’s cross-validation score. Forward selection starts empty and adds features; backward selection starts full and removes features.
Constructors
| Constructor | Summary |
|---|---|
SequentialFeatureSelector(int nFeaturesToSelect, SelectionDirection direction, Func<Matrix<T>, Vector<T>, int[], double> scorer, int nFolds, int? randomState, int[] columnIndices) |
Properties
| Property | Summary |
|---|---|
SelectionDirection Direction { get; } |
|
bool SupportsInverseTransform { get; } |
|
double[] FeatureScores { get; } |
|
int NFeaturesToSelect { 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) |