Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

In the blog found here:

http://alexdavies.net/2011/10/word-lists-for-sentiment-analysis-of-twitter/

the author discusses sentiment analysis with Naive Bayes. He uses Naive Bayes to predict if a tweet is happy or sad, but instead of the prediction being a binary value he produces the probability of happiness. He combines the probability of happy and the probability of sad into one probability.

His formula is such:

w = set of words

s = set of categories (only happy and sad)

$$p(s \mid \bar{w}) = \left( \sum_{s'} \exp \left( \sum_{w \in \bar{w}} \log p(w, s') - \log p(w,s) - \log p(s') + \log p(s)\right) \right)^{-1}$$

$$p(\mathrm{happy} \mid \bar{w}) = \left( \exp \left( \sum_{w \in \bar{w}} \log p(w, \mathrm{sad}) - \log p(w, \mathrm{happy})\right) + 1\right)^{-1}$$

Why does the math transform the two log probabilities to p(happy | w)? Doesn't subtracting the logs give you the ratio of sad to happy?

share|improve this question
1  
Do you know Naive Bayes? Did you follow the working that the author of the blog shows in his blog post? –  TenaliRaman Jul 14 '12 at 4:10
    
I haven't read it but I know if there is independency condition, then likelihood ratios are summable. This means your assertion can be correct iff the observations, in this case the words, are independent of each other. If this is not the case. There will be some additional terms taking into account the correlations. In case of correlations, the overall accuracy of the system to estimate the level of happiness will degrade compared to independent case. I hope it helps. –  Seyhmus Güngören Jul 15 '12 at 12:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.