TreeBasedFS<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Embedded

Tree-Based Feature Selection using decision tree splits.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Decision trees ask questions like “is feature X greater than value V?” to split data. Features that lead to purer groups (where samples in each group are mostly the same class) are more important. This method finds which features make the best splitting questions.

How It Works

Builds a simple decision tree and measures feature importance by how much each feature improves predictions when used for splitting. Features that create better splits are considered more important.

Constructors

Constructor Summary
TreeBasedFS(int nFeaturesToSelect, int maxDepth, int minSamplesLeaf, int? randomState, int[] columnIndices)

Properties

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