TraceRatio<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Filter.Spectral

Trace Ratio criterion for multi-class feature selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

This extends Fisher Score to consider how features work together. Instead of scoring each feature independently, it evaluates how a set of features collectively separates classes.

How It Works

Trace Ratio maximizes the ratio of between-class scatter to within-class scatter. Unlike Fisher Score which works per feature, Trace Ratio considers feature interactions through scatter matrices.

The subset is found with the iterative algorithm of Nie, Xiang, Jia, Zhang and Yan (2008), “Trace Ratio Criterion for Feature Selection” (AAAI): with lambda the trace ratio of the current subset, the next subset is the k features with the largest Sb - lambda Sw, repeated until the subset stops changing. Every change raises lambda, and the loop ends at the k-subset with the globally largest trace ratio.

Constructors

Constructor Summary
TraceRatio(int nFeaturesToSelect, int[] columnIndices)

Properties

Property Summary
T TraceRatioValue { get; }
Vector<T> FeatureScores { 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)