GainRatioSelection<T>
Models & Types · AiDotNet.Preprocessing.FeatureSelection.Filter
Gain Ratio Feature Selection (normalized Information Gain).
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → GainRatioSelection<T>
Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>
For Beginners
Information gain tends to favor features with many unique values (like IDs), even if they’re not truly useful. Gain ratio fixes this by dividing the information gain by how “spread out” the feature values are. This gives fairer scores across features with different numbers of unique values.
How It Works
Gain Ratio normalizes information gain by the intrinsic information of the feature (split information). This corrects for the bias of information gain towards features with many values.
Constructors
| Constructor | Summary |
|---|---|
GainRatioSelection(int nFeaturesToSelect, int nBins, int[] columnIndices) |
Properties
| Property | Summary |
|---|---|
Vector<T> GainRatioScores { get; } |
|
Vector<T> InformationGain { get; } |
|
Vector<T> SplitInfo { 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) |