Adaline
Last updated
Two years after the perceptron, Bernard Widrow and Ted Hoff at Stanford made one small change to it: learn from the weighted sum itself, before the step. That turns learning into gradient descent on a squared error, the method of Stage 3, and it fixes the perceptron's worst habit: Adaline settles down even when the classes overlap. This lesson trains it, compares it with the perceptron, and breaks it the way Stage 3 broke linear regression.
By the end of this lesson you can
- Write Adaline's update rule, and say how it differs from the perceptron's
- Show that the Widrow–Hoff (LMS) rule is stochastic gradient descent on squared error
- Train Adaline in NumPy and compare its weights with the least-squares answer
- Explain why unscaled inputs and a big learning rate make it diverge
Widrow and Hoff (1960)
In 1960, Bernard Widrow, a young professor of electrical engineering at Stanford, and his graduate student Ted Hoff built Adaline, the ADAptive LINear Element. Like the perceptron it was a single unit with a weighted sum and a step, built as a machine; Widrow soon invented a new kind of adjustable resistor for its weights, the memistor.
What was new was how it learned. The Widrow–Hoff rule, also called LMS (least mean squares) or the delta rule, was so practical that it spread far beyond neural networks: it's still used in adaptive filters, which cancel echoes on phone lines and noise in headphones. (Hoff went on to Intel, where he helped design the first microprocessor.)
Learn from the weighted sum, not the step
Adaline predicts exactly like the perceptron: the sign of the weighted sum, , with . The difference is what it learns from:
- The perceptron compares the label with the step's output, . The difference is 0 when it's right and when it's wrong: it only knows whether it was wrong.
- Adaline compares the label with , the weighted sum before the step. The difference says how far off it was.
So Adaline moves on every example, by an amount that depends on its error:
An example far on the wrong side moves the weights a lot. An example on the right side, but with when the label is , still moves them a little, to push towards 1. And as the weights get better, the errors shrink, and so do the steps. That's why Adaline settles where the perceptron jumps.
The squared-error loss
The rule comes from a loss. For one example, Adaline's is the squared error between the label and the weighted sum:
That's exactly linear regression's loss (lesson 3.1), with the labels and as the numbers to predict. The is there to cancel the 2 that the derivative brings down. So Adaline is a linear regression, fitted to the labels, with a step put on the end to turn its number into a class.
Adelie against Gentoo again, scaled. The mean loss falls from 0.228 after the first epoch to 0.117, 0.071, 0.052, and is 0.038 after 20. Every penguin is classified correctly.
LMS is gradient descent
Take the derivative of with respect to one weight, with the chain rule (lesson 1.7): depends on through , so
A step of gradient descent moves against the gradient: . That's the Widrow–Hoff rule. Applied one example at a time, it's stochastic gradient descent (lesson 3.6) on the squared error.
So Adaline should end up near the least-squares answer, the weights that make the mean squared error smallest, which lesson 3.5 computed exactly:
Least squares gives weights and and a bias of ; Adaline, after 20 epochs, , and . Close, and closer with more epochs or a smaller learning rate at the end. Everything Stage 3 said about gradient descent, learning rates, batches and scaling now applies to a neuron.
Perceptron against Adaline
The difference shows best where the classes overlap. Both trained on Adelie and Chinstrap bills, one point at a time, in the same order:
Solid: the perceptron, 11 wrong. Dashed pink: Adaline, 9 wrong, with loss 0.276. Move the slider: the perceptron's line jumps every epoch and its count of wrong points goes up and down; Adaline's line glides and its loss only falls.
The perceptron's line jumps every epoch, and how many points it gets wrong goes up and down. Adaline's line glides into place, and its loss falls and levels off. On the separable penguins both finish happily:
The perceptron stops after 2 epochs, its job done the moment nothing is wrong. Adaline keeps going after every point is right, because its loss isn't 0: it's still pulling each towards its label. Its line ends up where the squared error over all the penguins is smallest, decided by every point, while the perceptron's line is wherever it happened to stop.
Adaline has a weakness of its own, though. Its loss punishes an example for being too right: a Gentoo with is "wrong" by 2, and pulls the line towards itself. Far-off examples on the correct side can drag the boundary into the wrong place. Logistic regression fixes that (lesson 5.5).
Wrong way: unscaled inputs and a big learning rate
Lesson 3.7 warned that gradient descent struggles when features are on very different scales. Adaline inherits the problem. Bill depth in millimetres (13 to 22) and flipper length in millimetres (172 to 231), not scaled, with full-batch gradient descent and a learning rate of 0.0001:
The loss starts at 0.5, then goes 0.505, 0.563, 1.14, 6.79, 62.5, 611, 6,010: about nine times bigger every step. It's diverging. Flipper lengths around 200 make the gradient in the flipper weight's direction huge, so each step overshoots the bottom of the valley by more than it started, back and forth, further each time. A learning rate that would be tiny for scaled inputs is far too big for these.
Scale the inputs (lesson 3.7) and the same method, with a learning rate 1,000 times bigger, settles smoothly:
0.5, 0.362, 0.266, 0.198 and down. The perceptron never had this problem, since its steps don't depend on the size of the error, but Adaline's do. The cure is lesson 3.7's: scale the features, and if the loss grows, lower the learning rate.
Check what you learned
Sources
Every example on this page was run with Python 3.14, and its output and error messages are copied from it. These pages cover the same ground in more depth.
- Widrow and Hoff, Adaptive switching circuits, IRE WESCON Convention Record, 1960: Adaline and the LMS rule
- Widrow and Lehr, 30 years of adaptive neural networks: perceptron, Madaline, and backpropagation, Proceedings of the IEEE 78(9), 1990: Widrow's own history of Adaline and what grew from it
- Goodfellow, Bengio and Courville, Deep Learning, chapter 5: Machine Learning Basics: linear regression and stochastic gradient descent