Exclusive or −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
Exclusive or, XOR: the output is 1 when only one of the two inputs is 1. Red circles are dots with output 1, blue squares those with 0. Tap a dot to change its expected output.
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.
The perceptron tries −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In epoch 3, the dot (0, 1) is wrong: expected 1, output 0. The weights were updated: w₁ = 0.10, w₂ = −0.20, b = 0.10. This step made 6 updates.
The perceptron tries −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In epoch 5, the dot (1, 1) is wrong: expected 0, output 1. The weights were updated: w₁ = −0.10, w₂ = −0.20, b = 0.10. This step made 6 updates.
The perceptron tries −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In epoch 7, the dot (1, 1) is wrong: expected 0, output 1. The weights were updated: w₁ = −0.30, w₂ = −0.20, b = 0.10. This step made 6 updates.
The perceptron tries −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In epoch 9, the dot (0, 1) is wrong: expected 1, output 0. The weights were updated: w₁ = −0.30, w₂ = 0, b = 0.10. This step made 6 updates.
The perceptron tries −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In epoch 10, the dot (1, 1) is wrong: expected 0, output 1. The weights were updated: w₁ = −0.30, w₂ = −0.20, b = 0.10. This step made 6 updates.
Could not learn −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
10 epochs and 30 updates are over, and some dots are still wrong. The line keeps swinging from one side to the other.
No line can separate it −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
In this gate the reds sit on one diagonal and the blues on the other. Whatever line you draw, both colours remain on one of its sides. So however hard it tries, the perceptron cannot learn; Minsky and Papert showed this in 1969.
Two lines are enough −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
Using two lines instead of one solves it: above the line x₁ + x₂ = 0.5 and below x₁ + x₂ = 1.5, that is the strip between them, is the 1 region of exclusive or. Each line is a neuron; a third neuron is needed to combine them. That is a hidden layer.
Why it matters −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
The limit of a single line led to years of stagnation in artificial intelligence. The answer was to add layers: networks with hidden layers can draw boundaries of any shape. This is where today's deep learning starts.