Foundations
The perceptron
A perceptron draws a learned linear decision boundary by thresholding a weighted sum of input features.
Updated
1
Concept
The perceptron is a small model with a large historical footprint. It receives a feature vector , stores one weight per feature in , adds a bias , and computes . A threshold turns that score into one of two classes. With labels encoded as and , the prediction is the sign of .
Each weight controls how one feature contributes. A positive weight raises the score as its feature increases; a negative weight lowers it. The absolute magnitude reflects sensitivity in the units presented to the model. The bias is an intercept: it changes the baseline score when all input features are zero. Feature scaling matters because a large numerical range can dominate even when its underlying property is not more informative.
In two dimensions, the equation describes a line. Points on one side produce positive scores and points on the other produce negative scores. The vector is perpendicular to that line. Changing the weight ratio rotates the boundary; changing shifts it without rotation. In more dimensions, the same boundary is a hyperplane.
The classic perceptron learning rule reacts to mistakes. For a misclassified example , one form updates and , with learning rate . A positive example predicted negative pulls the weight vector toward that input; a negative example predicted positive pushes it away. Correct examples need no update under the basic rule.
If a dataset is linearly separable, the perceptron convergence theorem says this mistake-driven procedure reaches some separating hyperplane after finitely many mistakes under standard assumptions. It does not promise the widest margin, calibrated probabilities, or good generalization. The chosen separator depends on data order, scaling, initialization, and updates. Separability is a property of the supplied representation, not necessarily of the underlying world.
XOR exposes the limitation. Label and one class, and and the other. No line divides the diagonal pairs correctly. Training longer cannot make one perceptron represent a non-linear boundary. Adding useful transformed features or composing multiple units with a nonlinearity changes the representation and can solve it. That step leads directly to multilayer networks.
The hard threshold also has zero derivative almost everywhere and is discontinuous at the boundary, which makes ordinary gradient-based learning unsuitable. Modern binary classifiers often keep the linear score but use a differentiable sigmoid during training and a probabilistic loss. The decision may still be thresholded later. Separating training score, probability interpretation, and final policy threshold avoids confusion.
Language models contain vastly more machinery, yet perceptron logic remains visible. A neuron computes a weighted sum plus bias before an activation. Linear classification heads map hidden vectors to logits. Dot products score compatibility. The perceptron teaches the essential geometry: learned weights define a direction, bias defines an offset, and a model can only separate patterns made accessible by its representation.
When inspecting a fitted boundary, plot the examples and margins rather than reporting accuracy alone. A separator can classify the small training sample perfectly while lying dangerously close to every point, making tiny measurement noise reverse decisions.
2
Explain it like I am five
A museum guard scores each bag using a checklist: metal-object count weighs positively, a verified equipment tag weighs negatively, and a baseline bias shifts strictness. The scores are added. Above a threshold the bag receives inspection; below it passes. Changing weights rotates the policy’s boundary, while changing the bias slides it. No matter how the checklist is tuned, one straight boundary cannot isolate visitors arranged in an XOR checkerboard.
3
Teach it back
Explain the perceptron's weighted sum, bias, threshold, learning update, and linear-separability limitation with a two-feature example.
Minimum: 80 characters and 15 words. Your text stays only in this browser.
Saved only on this device.
Show a model answer
For features x, the perceptron computes z=w·x+b and assigns a class from the sign of z. In two dimensions z=0 is a line; weights set its orientation and bias shifts it. On a misclassified example, the update moves weights toward the correct labeled input. If no line separates the classes, as in XOR, updates cannot converge to a perfect separator because the representational limitation is structural, not an optimizer failure.
4
Check your understanding
Complete the teach-back and answer the quiz correctly to finish this lesson.
Sources
- Frank Rosenblatt (1958). The Perceptron: A Probabilistic Model for Information Storage and Organization in the Brain.