ChiSquare<T>

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

Chi-Square (χ²) test for feature selection in classification.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

The Chi-Square test checks if the distribution of a feature is different for different classes. If the values of a feature look very different between classes, it gets a high score because that difference can help predict class membership.

How It Works

Chi-Square feature selection measures the dependence between features and class labels using contingency tables. Features with high chi-square scores have a significant statistical relationship with the target.

Constructors

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

Properties

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