Visual explainer
Perceptron
One neuron draws one straight border by weighting inputs, then fixes mistakes step by step.
Binary classification problems require partitioning an input feature space into two distinct regions. When two data clusters are linearly separable in two dimensions, there exists at least one separating hyperplane:
Guessing parameter values arbitrarily risks misclassifying points along the boundary corridor. Instead of manual trial and error, Frank Rosenblatt's perceptron provides an algorithmic mechanism that discovers an exact separating hyperplane directly from labeled training samples by iteratively correcting classification errors.
Weigh Then Threshold
At the core of the perceptron is an affine transformation followed by a Heaviside step activation function. For an input vector , synaptic weights , and scalar bias :
The scalar pre-activation is passed to the step threshold:
Because , the neuron outputs ("YES"). Geometrically, represents the signed, unnormalized distance from sample point to the decision boundary line, with positive values placing the sample in the positive half-space.
Fix One Mistake
When the perceptron predicts correctly (), no parameters change. When it makes an error, the perceptron learning rule applies an immediate additive vector correction:
Consider an initial state encountering a positive sample with true label . The model evaluates , producing an error . With learning rate :
On the very next forward pass over that sample, the new score evaluates to . Adding the input vector directly tilts the normal vector toward the misclassified sample, immediately repairing the prediction.
Tilt The Border
In feature space, the decision boundary line is orthogonal to the weight vector . When a weight update occurs, the normal vector rotates toward the outlier sample point .
This rotation causes the decision boundary line to pivot into , sweeping the misclassified sample across the threshold into the correct half-space. As long as the data is linearly separable, well-behaved margin gaps ensure that rotating to encompass an outlier does not displace previously settled points.
Four Fixes Converge
Albert Novikoff proved in 1962 that if a dataset is linearly separable with geometric margin and maximum sample radius , the perceptron algorithm is guaranteed to converge in a finite number of updates :
Tracing four sequential updates on a four-sample problem illustrates this theorem in practice. The classifier begins at 2 of 4 (50%), improves to 3 of 4 on subsequent mistake corrections, and reaches a perfect 4 of 4 (100%) on step 4. Once all samples lie on their correct sides of the hyperplane, zero errors occur, zero updates trigger, and the algorithm halts permanently.
Size Your Steps
The learning rate parameter controls the magnitude of each geometric pivot:
- Clean, Separable Data (): Full unit steps take bold jumps through weight space. Because Novikoff's finite bound holds, large steps find a valid separating hyperplane in minimal training epochs.
- Noisy or Overlapping Data (): When classes overlap or labels contain noise, strict linear separation is impossible. A full step of causes weights to thrash violently as single noisy points repeatedly yank the hyperplane back and forth. Reducing to dampens outlier shocks, stabilizing the boundary around an average consensus. Pairing small steps with the Pocket Algorithm—which archives the best weight vector encountered so far—prevents catastrophic forgetting.
Where It Breaks
In 1969, Marvin Minsky and Seymour Papert proved that a single-layer perceptron cannot solve the exclusive-OR (XOR) function:
Because opposite diagonal corners share identical class labels, any single straight cut can achieve at most 3 out of 4 correct classifications (a 75% accuracy ceiling). The algebraic requirements , , and inevitably force , misclassifying as positive.
Overcoming this limitation requires a Multi-Layer Perceptron (MLP): introducing an intermediate hidden layer with non-linear activation functions bends the coordinate manifold, allowing multiple hyperplanes to combine into convex separating channels.
The Quick Version
- One artificial neuron learns a single straight linear decision boundary.
- Inputs are weighted, summed with bias (), and thresholded at zero.
- Each classification error shifts weights by adding the misclassified input vector.
- In feature space, updates rotate the boundary line to sweep outliers onto the correct side.
- Novikoff's theorem guarantees finite convergence () for linearly separable data.
- Use full steps () for clean separable data and small steps () for noisy labels.
- Single perceptrons cannot solve XOR; non-linear hidden layers are required to bend boundaries.