Part II's Chapter 11 found the best possible line separating two classes by solving an optimization problem. What's the simplest algorithm that finds merely a working line at all?
Same two clusters as the SVM — short for Support Vector Machine — chapter. Take a step: one point gets checked against the current line. If it's already on the right side, nothing happens. If it's wrong, the line moves — just enough to nudge that one point onto its correct side.
This is the perceptron, one of the oldest learning algorithms. It's a single artificial neuron: a weight vector and bias predict . Whenever a prediction is wrong, it corrects itself by exactly the term that caused the error:
- — the weight vector, the perceptron's current line direction.
- — the bias, shifting the line away from the origin.
- — the learning rate, controlling how big a correction each mistake causes.
- — the true label of the point just checked, or .
- — the input point's coordinates.
- No calculus needed
Whenever the prediction is wrong (with the true label, or ), the rule above nudges and directly toward correctness — no calculus, no loss function to minimize, just "if wrong, shift toward being right."
Watch and directly. They only change on the two steps that actually hit a misclassified point — every other step leaves them untouched. The line isn't being optimized; it's being corrected, one mistake at a time.
Starting at , :
- First point — a mistake
is class A (label ), but — wrong. The update: , .
- Next three points — no change
Already correctly classified by this new line.
- Point five — another mistake
is class B (), but the current line predicts — wrong again: , .
- Converged
From here, all eight points — checked again in a full second pass — are already correct. Just two corrections, out of sixteen checks, and it's converged to , : the line .
Keep taking steps until the line correctly separates every single point.
The perceptron is guaranteed to converge on any linearly separable data — but unlike the SVM's max-margin line, it just stops at the first separator it finds, with no guarantee it's the widest one. It's also the smallest possible building block of a neural network: the next chapters are about what happens when you stack many of these together.