Skip to content
Calcrivo

Naive Bayes Probability Calculator

Calculate class probabilities for a Naive Bayes classifier given feature likelihoods.

Inputs

Comma-separated probabilities per feature

Comma-separated probabilities per feature

P(Class 1 | features)

0.939130

P(Class 2 | features)

0.060870

Predicted Class

1

Step by step

  1. Score C₁: prior × Π likelihoods

    0.6 × 0.8 × 0.6 × 0.9

    = 0.25920000

  2. Score C₂: prior × Π likelihoods

    0.40 × 0.3 × 0.7 × 0.2

    = 0.01680000

  3. Normalized P(C₁|features)

    0.259200 ÷ (0.259200 + 0.016800)

    = 0.939130

How it works

Naive Bayes classification computes P(C|features) ∝ P(C) × Π P(fᵢ|C) for each class, then normalizes. The 'naive' assumption is that features are conditionally independent given the class, which greatly simplifies computation and works surprisingly well for text classification, spam filtering, and sentiment analysis.

Formula

Naive Bayes

P(C|f1,...,fn) = P(C) * product(P(fi|C)) / P(f1,...,fn)

P(C)
Prior probability of class C
P(fi|C)
Likelihood of feature i given class C

Frequently Asked Questions

Why is it called 'naive'?

It assumes all features are conditionally independent given the class — a strong and usually unrealistic assumption. Despite this, Naive Bayes often performs well in practice, especially for text classification where the feature space is very high-dimensional.

How do you handle zero probabilities?

Laplace smoothing (adding a small constant to all counts) prevents any likelihood from being exactly zero, which would otherwise zero out the entire product for that class.

You might also need