How to use the Perceptron Simulator
- 1. Pick training dataChoose a logic gate or enter your own x1, x2, label rows.
- 2. Set learning rateChoose η and the maximum number of epochs.
- 3. TrainSee whether it converges and how the weights changed.
The perceptron rule
A perceptron computes z = w₁x₁ + w₂x₂ + b and outputs 1 if z > 0, otherwise 0. Training starts with all weights at 0. For each row it makes a prediction, and only when it is wrong does it update: w ← w + η × (target − output) × x and b ← b + η × (target − output).
Worked example (AND gate, η = 0.1, rows in order 00, 01, 10, 11): after epoch 1 the weights are 0.1, 0.1 and bias 0.1. The model keeps correcting until epoch 6 has no mistakes, ending at w1 = 0.2, w2 = 0.1, b = -0.2. Only (1, 1) gives 0.2 + 0.1 − 0.2 > 0, which is exactly AND.
Why XOR fails
A perceptron draws one straight line to separate the classes. AND, OR, NAND and NOR can all be split by a line, so the perceptron convergence theorem guarantees it will find one. XOR outputs 1 for (0, 1) and (1, 0) but 0 for (0, 0) and (1, 1); no single line separates them, so the weights cycle forever and accuracy never reaches 100%.
That limitation, highlighted by Minsky and Papert in 1969, is why we stack neurons into layers. A network with one hidden layer solves XOR easily: see it in the neural network playground using the XOR dataset.
- Try η = 1 on AND: the steps are bigger but the outcome is the same rule.
- Use custom data to test any two-feature problem.
Compare the step activation with smooth ones in the activation function plotter.
Frequently asked questions
Why does the order of rows matter?
Updates happen one row at a time, so a different order can lead to different final weights, though any correct line is a valid answer.
Is z = 0 counted as 1 or 0?
Here z = 0 outputs 0. Some textbooks use ≥ 0; it can change the path but not whether it converges.
Is the Perceptron Simulator free?
Yes, the Perceptron Simulator is free. The first time you train your first perceptron, you are asked for your name and WhatsApp number once. After that, this and every other Uncodemy tool opens straight away without the form.