BidirectionalSelection<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Wrapper

Bidirectional (Stepwise) feature selection combining forward and backward steps.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Pure forward selection can get stuck with a bad early choice. Bidirectional selection can fix this by occasionally removing a feature that’s no longer useful after others were added. It’s like being able to change your mind as you build the feature set.

How It Works

Alternates between forward selection (adding features) and backward elimination (removing features). This allows correcting early poor choices and often finds better subsets than pure forward or backward methods.

Constructors

Constructor Summary
BidirectionalSelection(int nFeaturesToSelect, double alphaAdd, double alphaRemove, Func<Matrix<T>, Vector<T>, int[], T> scoringFunction, int[] columnIndices)

Properties

Property Summary
Vector<T> FeatureImportances { get; }
bool SupportsInverseTransform { 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)