What is multinomial naive Bayes?


#1

Question

In this lesson we use scikit-learn's MultinomialNB class to implement a naive Bayes classifier. What is multinomial naive Bayes? Why isn’t the class simply called NaiveBayes?

Answer

The word multinomial in MultinomialNB refers to the probability distribution underlying our application. To be more explicit, remember that we must have an idea of how the probabilities for our application are computed (whether everything is equally likely, a uniform distribution, or our data is normally distributed, or something else).

Naive Bayes does not tell us how to choose this underlying distribution; it provides us with an equation to use once we have worked out how to compute the probabilities. So naive Bayes is a very general term and we could use different classes based on the different distributions we decide are appropriate for our application. For example, sklearn.naive_bayes provides the following variants of naive Bayes, where the difference is in the underlying probability distribution

  • BernoulliNB
  • GaussianNB
  • MultinomialNB
  • ComplementNB

This is why we don’t simply call the class NaiveBayes – the underlying distribution is important.