Every time an AI labels something — spam vs. legitimate, cat vs. dog, pass vs. fail — it is doing classification. This lesson shows exactly how that works.
The trick that makes classification learnable is simple: turn every example into a point on a grid.
The interactive plot below shows 60 emails already plotted. Hover or tap any dot to see the actual email stats that placed it there.
Hover a dot to inspect it →
Notice how the red cloud (spam) gathers toward the top-right — many links, many caps words — while the green cloud (legitimate) stays bottom-left. They overlap a little in the middle. That messy overlap is where classifiers make mistakes, and that is normal.
Before the machine learns, you try. For each email below, look at its two measurements and decide: spam or legitimate? You are doing exactly what the classifier will do.
Where you hesitated — emails with mid-range link and caps counts — is precisely where any rule struggles. Those are the examples near the decision boundary.
After seeing the labeled dots, the classifier draws an imaginary line (or curve) that puts as many green dots on one side and red dots on the other as possible. That line is the decision boundary.
Any new email dropped on the plot lands on one side of the line — and that side is its label. Drag the threshold slider below and watch the boundary move. See how accuracy changes as you adjust where the cut is made.
Moving the boundary left catches more spam but also flags more legitimate mail as spam (false positives). Moving it right misses some spam but leaves legitimate mail alone. The "best" position depends on which mistake is more costly.
A trained classifier should handle examples it has never seen. Click anywhere on the plot to drop a new email dot. The classifier predicts its label based on which side of the learned boundary it lands on.
Click on the grid to classify a new email →
The axes are deliberately generic in the real lesson demonstration — they carry no particular units, because the procedure works the same regardless of what the two measurements actually are.
Four quick questions to lock in the concepts.