TreeBasedImportance<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Embedded

Tree-based feature importance using random forest mean decrease impurity.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Random forests build many decision trees, and each tree splits the data at various points. When a feature is used for a split, it reduces the “messiness” (impurity) of the data. Features that consistently help clean up the mess get high importance scores.

How It Works

Tree-based importance measures the average reduction in impurity (Gini or entropy) achieved by splits on each feature across all trees in a random forest. Features that are used for impactful splits get higher importance scores.

Constructors

Constructor Summary
TreeBasedImportance(int nFeaturesToSelect, int nTrees, int maxDepth, int minSamplesPerLeaf, int? randomState, int[] columnIndices)

Properties

Property Summary
Vector<T> ImportanceStds { get; }
Vector<T> Importances { get; }
bool SupportsInverseTransform { get; }
int NFeaturesToSelect { get; }
int NTrees { 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)