GiniIndex<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Filter

Gini Index feature selection for measuring impurity reduction.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Imagine randomly guessing the class of an item. The Gini Index measures how often you’d guess wrong. A feature that separates classes well will have a low Gini Index (few wrong guesses). This is the same metric used by decision trees like CART to choose splits.

How It Works

The Gini Index measures the impurity of a split based on the probability of misclassifying a randomly chosen element. Features that result in lower weighted Gini impurity after splitting are considered more informative.

Constructors

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

Properties

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