I was wondering how one would calculate the pointwise mutual information for text classification. To be more exact, I want to classify tweets in categories. I have a dataset of tweets (which are annotated), and I have a dictionary per category of words which belong to that category. Given this information, how is it possible to calculate the PMI for each category per tweet, to classify a tweet in one of these categories.
I was wondering how one would calculate the pointwise mutual information for text classification.
Share
PMI is a measure of association between a feature (in your case a word) and a class (category), not between a document (tweet) and a category. The formula is available on Wikipedia:
In that formula,
Xis the random variable that models the occurrence of a word, andYmodels the occurrence of a class. For a given wordxand a given classy, you can use PMI to decide if a feature is informative or not, and you can do feature selection on that basis. Having less features often improves the performance of your classification algorithm and speeds it up considerably. The classification step, however, is separate- PMI only helps you select better features to feed into your learning algorithm.Edit:
One thing I didn’t mention in the original post is that PMI is sensitive to word frequencies. Let’s rewrite the formula as
When
xandyare perfectly correlated,P(x|y) = P(y|x) = 1, sopmi(x,y) = 1/P(x). Less frequentx-es (words) will have a higher PMI score than frequentx-es, even if both are perfectly correlated withy.