← All simulations · Pillar 5: Making decisions
The perceptron
What it is
A perceptron is a single artificial neuron — the simplest learning machine there is. It takes a couple of numbers, multiplies each by its own weight, adds them up together with a bias, and asks one question: is the total above zero or below it? Above → say “Group A.” Below → say “Group B.” That single yes/no is the whole decision.
Go deeper: the weights and bias are just the equation of a straight line. Changing a weight tilts the line; changing the bias slides it. So a perceptron is a straight-line decision boundary, and “learning” means nudging those three numbers until the line sits between the two groups. The learning rule does the nudging automatically: every time the neuron gets a point wrong, it shifts its weights a little toward fixing that point.
Why care
The perceptron is the seed that grew into every modern neural network. Stack many of them in layers and you get the deep networks behind image recognition and chatbots — but each one is still just a weighted sum and a threshold. Understand this one neuron and you understand the building block of the whole field. It also teaches a hard, important lesson: some problems a single line simply cannot solve.
The idea, intuitively
Picture a line you can tilt and slide. Each point sits on one side or the other, and that side is the neuron’s guess. Tune the three weight sliders by hand to swing the line between the two groups, or press Learn one step and watch the rule do exactly what you would: find a point on the wrong side, then nudge the line toward it. Repeat until no point is left stranded.
Peek at the data first
Each point is just two numbers (its position) and the group it belongs to. That’s the same
shape of data a neuron learns from — like what Spectra’s describe_data
would show you before training.
Try it
Drag the three sliders — weight 1 and weight 2 tilt the line, the bias slides it — to split the two groups by hand. Or let the neuron do it: Learn one step applies the rule once so you can watch each nudge, and Run to the end repeats until it’s solved. Misclassified points get a red ring. Then turn on Groups a line can’t split to meet the pattern that defeats a single neuron — no matter how you tune it, the line can never get them all.
Where it shows up
- Neural networks. Every node in a deep network is a perceptron with a smooth threshold; training nudges all their weights at once.
- Simple linear classifiers. When two groups are cleanly separable, one neuron is fast, tiny, and easy to explain.
- Knowing a model’s limits. The line a perceptron can draw shows exactly which problems need something more flexible.
Where it came from
Frank Rosenblatt built the perceptron in 1958 and proved its learning rule will always find a dividing line if one exists — the data has to be linearly separable. In 1969 Marvin Minsky and Seymour Papert showed the catch: a single perceptron can’t even solve XOR, a tiny pattern where the groups sit in opposite corners. That limit cooled interest for years — until people stacked perceptrons into layers and the field roared back to life.
Try it in code
In the Studio, a straight-line classifier learns weights like this neuron does;
show_model reveals how it splits the space:
data = load "fruits" train, test = split data, hold_out: 20% model = make_model "classifier" train_model model, on: train, predict: "type", using: ["sweetness", "size"] check model, with: test show_model model
Check your understanding
- In your own words, what do the weights and the bias each do to the line?
- How does the learning rule decide which way to nudge the weights?
- Why can’t a single perceptron split the “opposite corners” pattern, no matter how you tune it?