ChiSquareText<T>

Models & Types ยท AiDotNet.Preprocessing.FeatureSelection.Text

Chi-Square test for text classification feature selection.

Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> โ†’ ChiSquareText<T>

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

This test finds words that appear significantly more often in one class than expected by chance. These discriminative words are the best features for text classification.

How It Works

Applies chi-square test to measure the association between terms and document classes. Terms with high chi-square values are more discriminative.

Constructors

Constructor Summary
ChiSquareText(int nFeaturesToSelect, bool binarize, int[] columnIndices)

Properties

Property Summary
Vector<T> ChiSquareScores { 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)