# Chi square distribution for feature selection

In one paper on ML I read that chi square distribution is used to reduce the number of features. In that paper, features are words. That paper is related to Sentiment Analysis, so we have "positive", "negative" and "neutral" category.

• How to calculate chi square distribution in that case?

• In Python there is scipy.stats.chisquare which gives chi_square value and a p_value. What do we do then with these two pieces of information?

• What to do for example with word "good" as a feature?

• How to calculate chi square distribution, and what to do with that?

• What does it mean to exclude some feature from the set of features, because in that paper it is mentioned that we take n of them with top chi square.

I really don't know how to do it. If there is any paper or book or link to learn that, please tell me.

As you can see scikit-learn has an implementation for feature_selection using chi2 (perhaps according to scipy.stats.chisquare) as was shown very briefly in the above-mentioned blog post.