Also called the naive Bayes classifier and simple Bayes.
test yourself
Six questions, four to pick from and two for paper. A point such as 2 8 t is a triangle at 2 across, 8 up (s is a square, c a circle). Each answer stays hidden until you open it.
Points 2 8 t, 7 8 s, 6 2 c, 3 2 t and 8 5 s, and a new point at 5 across, 4 up. The smoothing count is 1. How many points does naive Bayes count?
the answer, and why
the answer is C
One for each of the 5 points, each added once to its class's row.
if you chose another
AThat counts the classes, each scored once after the counting.
BThat counts each point twice, once for each band; it is one point read once.
DThat is the smoothing count; it is added to counts, never counted.
2question 2
On the same points, what do the squares score?
the answer, and why
the answer is C
The squares at 7 8 and 8 5 are 2 of 5. Neither is in band 4 to 6 across, so 0 + 1 over 2 + 3. One is in band 4 to 6 up, so 1 + 1 over 5. 2/5 × 1/5 × 2/5 = 0.032.
if you chose another
AThat is the triangles' score, 2/5 × 1/5 × 1/5.
BThat is the circle's score, 1/5 × 2/4 × 1/4.
DThat is the squares' share of the points alone, 2 of 5.
3question 3
Five triangles, 1 9 t, 8 9 t, 9 7 t, 9 2 t and 8 1 t, and one square at 5 8. A new point at 4 across, 9 up, with no smoothing. What do the triangles score?
the answer, and why
the answer is C
No triangle stands in band 4 to 6 across, so one share is 0 of 5, and 0 times anything is 0.
if you chose another
AThat is their score with a smoothing count of 1.
BThat is their share in band 7 to 10 up alone, 3 of 5.
DThat is their share of all the points alone, 5 of 6.
4question 4
Which is true of naive Bayes on n points?
the answer, and why
the answer is A
Every point is added once to its class's row, so the count depends on n alone.
BThe smoothing count is added to counts already made; it counts nothing.
CWhere the points stand changes nothing; each is counted once.
DEvery point belongs to some class, so every point is counted.
pen and paper
5question 5about 12 minutes
Six points, 2 8 t, 7 8 s, 6 2 c, 3 2 t, 8 5 s and 1 1 t. A new point at 5 across, 4 up, with a smoothing count of 1.
Count each class's points, and its points in the new point's band across and band up.
Score each class, and say what the new point becomes.
Count the points counted, and check them against .
a hint
The new point is in band 4 to 6 across and band 4 to 6 up. Add 1 to each band count, and 3 to the bottom of each band share. A class's share of all 6 points is not smoothed.
a worked answer
Three triangles, none in either band: 3/6 × 1/6 × 1/6 = 0.014. Two squares, none across and the one at 8 5 up: 2/6 × 1/5 × 2/5 = 0.027. One circle, at 6 2, across but not up: 1/6 × 2/4 × 1/4 = 0.021. The squares score highest, so the new point becomes a square. The run has 6 points counted, and is 6.
Why does naive Bayes count exactly points, on every set of points?9 of 9 shown
1the move: see the counting
the line:
point
class
band across
band up
2 8
triangle
0 to 3
7 to 10
7 8
square
7 to 10
7 to 10
6 2
circle
4 to 6
0 to 3
3 2
triangle
0 to 3
0 to 3
Four points, each read once, its class and its two bands. Four counts.
why it is allowed: The run reads every point in turn, once, and adds 1 to its class's points and to its two bands. The table shows four.
2the move: one for each point
the line:
why it is allowed: is the points counted. By line 1, one for each of the points.
guess it, then
3the move: add the ones
the line:
why it is allowed: By line 2, ones add up to . For the four points, 4.
guess it, then
4the move: any set, any smoothing
the line:
why it is allowed: In line 1, how many points are counted never depends on where they stand or on the smoothing count, only on their being there.
guess it, then
5the move: a ceiling
the line:
why it is allowed: By line 3, is , so it is at most . Bounds still matter: they name how fast the count grows, as in section 3's grid.
guess it, then
6the move: read it as a bound
the line:
why it is allowed: By line 5, is at most 1 times .
guess it, then
7the move: a floor
the line:
why it is allowed: By line 3, is at least too.
guess it, then
8the move: read it as a bound
the line:
why it is allowed: By line 7, never drops below 1 times .
guess it, then
9the move: ceiling and floor together
the line:
why it is allowed: Lines 6 and 8 bound by the same growth, .
guess it, then
try it on small inputs: over every set of 4 points, wherever they stand, the average is
Take section 5's four points, 2 8 t, 7 8 s, 6 2 c and 3 2 t, and the new point at 5 across, 4 up.
With no smoothing, what does each class score, and why?
With a smoothing count of 1, what does each score now?
Which answer uses what the points show, and which ignores it?
a hint
Look for each class's empty band.
a worked answer
With no smoothing every class scores 0. No triangle and no square stands in band 4 to 6 across, and the circle is not in band 4 to 6 up. The tie goes to the class with more points, the triangles, on no evidence at all. With a smoothing count of 1, the triangles score 2/4 × 1/5 × 1/5 = 0.02. The squares score 1/4 × 1/4 × 1/4 = 0.016. The circle scores 1/4 × 2/4 × 1/4 = 0.031. The circle wins, as the only class with a point in one of the new point's bands.