InformationGain<T>
Models & Types · AiDotNet.Preprocessing.FeatureSelection.Filter.Univariate
Information Gain and Gain Ratio feature selection.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → InformationGain<T>
Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>
For Beginners
Information Gain measures how much a feature “tells you” about the target variable. If knowing the feature value greatly reduces your uncertainty about the outcome, it has high information gain.
Gain Ratio corrects for features with many categories (like IDs) that would otherwise appear artificially important.
How It Works
Information Gain measures how much knowing a feature reduces uncertainty about the target. Gain Ratio normalizes by the intrinsic value to handle features with many values.
Information Gain = H(Y) - H(Y|X) Gain Ratio = Information Gain / Intrinsic Value
Constructors
| Constructor | Summary |
|---|---|
InformationGain(int nFeaturesToSelect, int nBins, bool useGainRatio, int[] columnIndices) |
Properties
| Property | Summary |
|---|---|
Vector<T> Scores { get; } |
|
bool SupportsInverseTransform { 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) |