← chapter

The perceptron

A weighted sum, a hard threshold, and a rule that learns only from its mistakes.

The first neuron — the one that started neural networks, and the one that hit the wall.

Where it comes from

The fix (layers) was imaginable in 1969. Training the stack took until the 1980s.

The separable data

80 points, two classes, a clear gap. Built separable on purpose — that gap is the precondition for convergence.

The whole algorithm

Net input, then take the sign:

z=wx+by^=sign(z){1,+1}z = w^{\top}x + b \qquad \hat{y} = \operatorname{sign}(z) \in \{-1, +1\}

On a misclassified point, nudge the weights toward it:

ww+ηyxbb+ηyw \leftarrow w + \eta\, y\, x \qquad b \leftarrow b + \eta\, y

Correct points get nothing. Labels in {1,+1}\{-1, +1\} are what fold both cases into one line.

Converges in (R/γ)2\le (R/\gamma)^2 updates if the data is separable. Otherwise, never.

Watch it learn

One frame per correction. Orange line is the boundary; the red ring is the point being fixed; the bars count mistakes per epoch down to zero.

Zero weights → no line → a crude cut → swing until a pass is clean. 5 passes, 26 corrections.

The wall: XOR

No straight line separates these. Opposite diagonals share a class.

Mistakes per epoch: converge vs never

Separable drops to zero and stops. XOR bounces forever — no clean pass, no end.

Scratch vs library

Separable: both hit 100% — convergence theorem as a number. XOR: both at chance.

Separable 1.0 / 1.0. XOR 0.525 / 0.5125. Two identical bars at chance — the case for going deeper.

Takeaways