GiniImpuritySelector<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Gain

Gini Impurity based Feature Selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Gini impurity measures how “mixed” a set of labels is. Pure sets (all same class) have Gini = 0. Features that best split data into purer groups have higher Gini importance. This is fast to compute and widely used in tree-based methods like Random Forest.

How It Works

Selects features based on Gini impurity reduction, the same criterion used by CART decision trees to choose split features.

Constructors

Constructor Summary
GiniImpuritySelector(int nFeaturesToSelect, int nBins, int[] columnIndices)

Properties

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