Two classes 8 12 16 20 24 28 32 36 0 2 4 6 8 10 12 temperature, degrees sunny hours
The red circles are days when the ice cream sold out, the blue squares days when it did not. Naive Bayes will sum up each class on its own and then compare.
Prior probability 8 12 16 20 24 28 32 36 0 2 4 6 8 10 12 temperature, degrees sunny hours
Without looking at anything, the chance that a day sells out is 8 / 16 = 0.50. The chance it does not is 0.50. These are the prior probabilities.
The middle of each class 8 12 16 20 24 28 32 36 0 2 4 6 8 10 12 temperature, degrees sunny hours
The sold-out days average 27.50 degrees and 8.63 hours of sun. The other days average 18.38 degrees and 5 hours. The hollow circle and hollow square are these means.
The spread of each class 8 12 16 20 24 28 32 36 0 2 4 6 8 10 12 temperature, degrees sunny hours
Each feature of each class is summed up with a normal distribution. The inner ellipse is one standard deviation, the outer two. Temperature's standard deviation is 3.39 on sold-out days and 4.21 on the others.
The naive assumption 8 12 16 20 24 28 32 36 0 2 4 6 8 10 12 temperature, degrees sunny hours
Here is what is naive: once the class is known, temperature and sun are assumed independent of each other. That is why the ellipses are parallel to the axes, not tilted. The assumption is often wrong, yet the method still works well.
A decision for the new day 8 12 16 20 24 28 32 36 0 2 4 6 8 10 12 temperature, degrees sunny hours
26 degrees, 6 hours of sun. For each class, prior times temperature density times sun density is computed, then the two are divided so they add up to 1. Chance of selling out 0.74, of not 0.26.
Decision regions 8 12 16 20 24 28 32 36 0 2 4 6 8 10 12 temperature, degrees sunny hours
Doing the same computation for every point of the chart reveals the regions. Since the two classes spread differently, the boundary can be curved rather than straight.
Why it matters 8 12 16 20 24 28 32 36 0 2 4 6 8 10 12 temperature, degrees sunny hours
Naive Bayes trains very fast and works with little data too. The first generation of spam filters used the same idea with words: each word's chance of appearing in spam and in normal mail was counted separately.