ChiSquaredSelection<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Filter

Chi-Squared Feature Selection for categorical features.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

The chi-squared test checks if two things are related. If knowing the value of a feature helps predict the target, they’re related (high chi-squared). If the feature’s value tells you nothing about the target, chi-squared is low. This method keeps features that are most related to what you’re trying to predict.

How It Works

Uses the chi-squared statistic to measure the dependency between each feature and the target variable. Features with higher chi-squared values have stronger associations with the target.

Constructors

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

Properties

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