# Identifying most important words in text classification

I know one can use tf-idf to distinguish important words based on the number of times a word appears in a document relative to the number of times it appears in the entire collection of documents. However, how does one identify which words are most important in distinguishing the positive class from the negative class?

• What you mean by positive or negative class? – ᴀʀᴍᴀɴ Jan 18 '17 at 21:49
• For example, if you're performing sentiment analysis, so there are two classes (positive or negative). – Kyle Jan 18 '17 at 22:12

$$p(negative|s) = p(negative)p(w_1,w_2,w_3,...,w_n)$$ $$p(positive|s) = p(positive)p(w_1,w_2,w_3,...,w_n)$$
Which one is greater has more probability for $$s=w_1,w_2,w_3,...,w_n$$