InformationGainRatioSelector<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Gain

Information Gain Ratio based Feature Selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Information gain measures how much knowing a feature reduces uncertainty about the target. But features with many values (like IDs) can have artificially high gain. Gain ratio fixes this by dividing by the feature’s own entropy, giving a fair comparison across features.

How It Works

Selects features based on information gain ratio, which normalizes information gain by the feature’s intrinsic information to avoid bias toward features with many distinct values.

Constructors

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

Properties

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