GainRatio<T>
Models & Types · AiDotNet.Preprocessing.FeatureSelection.Filter
Gain Ratio for feature selection, normalizing Information Gain by feature entropy.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → GainRatio<T>
Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>
For Beginners
Information Gain tends to favor features with many unique values (like IDs). Gain Ratio fixes this by accounting for how complex the feature is. A feature that tells you a lot AND is simple gets a higher score than one that’s complex but only slightly informative.
How It Works
Gain Ratio addresses Information Gain’s bias toward features with many values by dividing by the feature’s intrinsic information (entropy of the feature itself).
Constructors
| Constructor | Summary |
|---|---|
GainRatio(int nFeaturesToSelect, int nBins, int[] columnIndices) |
Properties
| Property | Summary |
|---|---|
Vector<T> GainRatios { get; } |
|
Vector<T> InformationGains { 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) |