1
$\begingroup$

I found a naive Bayes classifier for positive sentiment or a negative sentiment Citius: A Naive-Bayes Strategy for Sentiment Analysis on English Tweets. But with most available datasets online, sentiments are classified into 3 types: positive, negative, and neutral.

How does the naive Bayes formula change for such cases? Or does it remain the same, and we only consider the positive and negative to calculate the log-likelihoods?

$\endgroup$
1
$\begingroup$

A Bayes classifier (naive or not) chooses the class that maximises the posterior, i.e. the chosen class is the $\text{argmax}_k p(C=k|x)$, where $x$ is the sample we want to classify. This formulation has nothing to do with number of classes, so it's essentially the same.

The posterior maximisation problem is typically formulated as $$\text{argmax}_k \log p(x|C=k) + \log p(C=k)$$ because the denominator term is just $p(x)$ and doesn't change with respect to $k$, and taking the logarithm of the expression can't change the argmax. The first multiplicand is the log likelihood (class conditional probability), and there is no it's calculated for each class, not only positive and negatives.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks a lot @gunes. It's a big help. Respect. $\endgroup$ – Md. Asif Iqbal Fahim Feb 14 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.