Interview Q&A / Machine Learning

IntermediateQuick answer1 min readUpdated 3 Oct 2026

What is the difference between Gaussian, Multinomial and Bernoulli Naive Bayes?

SHORT ANSWER

Gaussian NB assumes each feature is normally distributed within a class, so it suits continuous values. Multinomial NB models word counts. Bernoulli NB models binary present/absent features.

Explain it simply

All three use the same Bayes idea; they differ in how they model one feature's behaviour inside a class. Pick the version whose assumption matches the type of your feature.

Example

text
GaussianNB      continuous numbers (height, income, sensor reading)
                learns mean and variance per feature per class
MultinomialNB   counts (how many times each word occurs)
                or TF-IDF values
BernoulliNB     binary flags (does the word appear at all? yes/no)
                also penalises words that are absent

Example email "free free offer" using a 3-word vocabulary [free, offer, meeting]:

text
Count vector (Multinomial)  : [2, 1, 0]
Binary vector (Bernoulli)   : [1, 1, 0]
python
from sklearn.naive_bayes import GaussianNB, MultinomialNB, BernoulliNB

GaussianNB()          # numeric columns
MultinomialNB()       # CountVectorizer / TfidfVectorizer output
BernoulliNB()         # CountVectorizer(binary=True) output

For short texts such as SMS messages, Bernoulli or Multinomial are both common; try each with cross-validation. Gaussian NB on skewed data may do better after a log or power transform.

What to say in the interview

"Gaussian NB is for continuous features, Multinomial for counts or TF-IDF, Bernoulli for binary features. I choose by feature type and confirm with cross-validation."

Common mistakes

  • Feeding negative values (such as standardised data) into MultinomialNB.
  • Using GaussianNB on raw word counts.

#naive-bayes#text-classification#gaussian

Related questions

Practise more Machine Learning questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Machine Learning quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.