The Perceptron
The Perceptron — The original learning neuron: a linear threshold unit.
The perceptron is the ancestor of every neural network: it weights its inputs, sums them, and fires if the total crosses a threshold. It learns by nudging weights whenever it gets an example wrong.
- Class 0
- Class 1
- Boundary
- Drove this update
Perceptron controls
The idea in plain words
The perceptron is the ancestor of every neural network: it weights its inputs, sums them, and fires if the total crosses a threshold. It learns by nudging its weights whenever it gets an example wrong, rotating the boundary a little each time.
On separable data the line sweeps and snaps into place. But feed it XOR — not linearly separable — and it oscillates forever, never converging. That famous limitation is exactly what the multilayer perceptron overcomes.
Now, the math
The perceptron update rule nudges weights toward each misclassified point:
- the learning rate — how far the boundary moves per mistake.
- the error (±1), zero when the point is already correct.
▸ Show the derivation
The perceptron convergence theorem guarantees it finds a separating line in finite steps — but only if one exists. XOR has none, so the weights cycle endlessly. This gap between what a single linear unit can and cannot represent motivated stacking neurons into layers.
Trace it by hand
Two training points in the centered coordinates the visualization uses: point A at x = (2, 3) with true label y = 1, and point B at x = (-3, 2) with y = 0. Start from the core's initial weights w = (0.1, -0.1), b = 0, learning rate eta = 0.1. Predict class 1 whenever the score w dot x + b is at least 0.
Score point A with the initial weights
The true label is 1, so point A is misclassified. This one mistake is what triggers a weight update.
Apply the update rule at point A
The error y minus y-hat is plus 1, so each weight moves toward point A by eta times that coordinate.
Re-score point A with the new weights
One update flipped the score from -0.1 to +1.3 — point A is now on the correct side with a comfortable margin.
Check point B did not break
Zero errors remain, so the algorithm converges — the repo's perceptron core reports convergence after this single update.
What just happened: One misclassified point pulled the boundary toward itself: the update rule turned a -0.1 score into +1.3 for point A without disturbing point B, and the perceptron converged after a single mistake-driven step.
Now Break It
Try this: On non-linearly-separable data (XOR) the perceptron never converges — it oscillates forever.
Control: Switch dataset to XOR
What happens: Never converges! The perceptron can’t separate XOR — it will oscillate forever. This killed early AI hype.
Where the perceptron is used
The perceptron, introduced by Frank Rosenblatt in 1958, was the first algorithm that could learn its own weights from examples rather than having them hand-set, and it ran on custom hardware called the Mark I Perceptron built to recognize simple images. Its lineage runs straight through to modern machine learning: every neuron in today's deep networks is a descendant of this linear threshold unit that multiplies inputs by weights, sums them with a bias, and fires when the total crosses zero. The perceptron learning rule, which nudges weights toward misclassified points, is a direct ancestor of stochastic gradient descent and still underlies linear classifiers, spam filters, and the readout layers of far larger systems.
The most famous pitfall is that a single perceptron can only separate data with a straight line (a hyperplane), so it cannot learn the XOR function, a limitation Minsky and Papert highlighted in 1969 that helped trigger an AI funding winter. A common misconception is that this doomed neural networks entirely, but stacking perceptrons into layers with nonlinear activations solves XOR easily. Another pitfall is expecting the perceptron to converge on data that is not linearly separable; the classic learning rule only guarantees convergence when a separating line exists, and otherwise it oscillates indefinitely rather than settling on a best-fit compromise.
Frequently asked questions
What is a perceptron?
Why can't a perceptron solve XOR?
How does a perceptron learn?
Is a perceptron the same as logistic regression?
Are perceptrons still used today?
Written & reviewed by the ML Visualization team · Last updated .