RecursiveFeatureElimination<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Wrapper

Recursive Feature Elimination (RFE) for feature selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

RFE works like an elimination tournament. It trains a model, finds the weakest feature, removes it, and repeats. This continues until only the strongest features remain. It’s more thorough than one-shot methods because feature importance changes as features are removed.

How It Works

RFE recursively removes the least important features based on model weights or feature importances. At each step, a model is trained and the feature with the lowest importance is eliminated until the desired number of features remains.

Constructors

Constructor Summary
RecursiveFeatureElimination(int nFeaturesToSelect, int step, Func<Matrix<T>, Vector<T>, double[]> getImportances, int? randomState, int[] columnIndices)

Properties

Property Summary
bool SupportsInverseTransform { get; }
double[] Ranking { get; }
int NFeaturesToSelect { get; }
int Step { 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)