RandomForestImportance<T>

Models & Types ยท AiDotNet.Preprocessing.FeatureSelection.Embedded

Random Forest feature importance for feature selection.

Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> โ†’ RandomForestImportance<T>

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Random forests are ensembles of decision trees. When building each tree, features that better split the data are used more often and at higher positions. Feature importance is measured by how much each feature helps reduce errors across all trees.

How It Works

Builds a simplified random forest and measures feature importance based on how much each feature contributes to reducing prediction error (Gini importance or permutation importance).

Constructors

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

Properties

Property Summary
Vector<T> FeatureImportances { 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)