What is prior probability in Naïve Bayes and how is it estimated?

Updated May 17, 2026

Short answer

Prior probability represents the probability of a class before observing any features.

Deep explanation

Prior probability P(C) is estimated as frequency of class C in training data. It encodes baseline belief about class distribution. In imbalanced datasets, priors significantly influence predictions and may require reweighting or correction.

Real-world example

In spam detection, spam emails may form 20% of dataset, so P(spam)=0.2.

Common mistakes

  • Ignoring class imbalance leading to biased predictions.

Follow-up questions

  • How does class imbalance affect Naïve Bayes?
  • Can priors be manually set?

More Naïve Bayes interview questions

View all →