A logic gate −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
The four dots are every state of two inputs: (0, 0), (0, 1), (1, 0), (1, 1). Red circles have output 1, blue squares 0. Tap a dot to change its expected output; you can build any gate you like.
Starting weights −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
The neuron starts with w₁ = 0.50, w₂ = −0.40, b = 0.10. The black line is w₁x₁ + w₂x₂ + b = 0: the red region says 1, the blue region 0. Some dots are in the wrong region.
Learning from errors −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In epoch 1, the dot (1, 1) is wrong: expected 1, the neuron's output 0. The rule pushes the weights in proportion to the difference: w₁ = 0.50, w₂ = −0.20, b = −0.10. This step made 3 updates.
Learning from errors −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In epoch 2, the dot (1, 1) is wrong: expected 1, the neuron's output 0. The rule pushes the weights in proportion to the difference: w₁ = 0.50, w₂ = 0, b = −0.10. This step made 2 updates.
Learning from errors −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In epoch 3, the dot (1, 1) is wrong: expected 1, the neuron's output 0. The rule pushes the weights in proportion to the difference: w₁ = 0.50, w₂ = 0.20, b = −0.10. This step made 2 updates.
Learning from errors −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In epoch 4, the dot (1, 0) is wrong: expected 0, the neuron's output 1. The rule pushes the weights in proportion to the difference: w₁ = 0.30, w₂ = 0, b = −0.50. This step made 2 updates.
Learning from errors −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In epoch 5, the dot (1, 0) is wrong: expected 0, the neuron's output 1. The rule pushes the weights in proportion to the difference: w₁ = 0.30, w₂ = 0.20, b = −0.50. This step made 2 updates.
Learned −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In epoch 6 no dot is left wrong; 11 updates in all were enough. The final weights are w₁ = 0.30, w₂ = 0.20, b = −0.50. If the dots can be separated by a line, the perceptron always finds a separating line in the end.
Why it matters −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
The perceptron, built by Rosenblatt in 1958, was one of the first learning machines. The rule is simple, but the idea is still the same today: measure the error, push the weights in the direction that reduces it.