Does Chi squared test When used for feature selection, does the chi-squared test require the features to be nonnegative?
chi squared test used for feature selection in classification problems and implemented by
sklearn.feature_selection.chi2 requires the feature which it tests with the outcome to be nonnegative.
As I understand from Wikipedia, the chi squared independence test test independence between two discrete random variables with finite ranges from their joint samples. So the random variables can be categorical, positive, or nonnegative, as long as they are discrete and have finite ranges, i.e. we can create a contingency table from their joint samples.
So what features can the chi squared feature selection in sciki learnscikit-learn apply to?