Interactive playground
Neural Network Playground
Train a real neural network right in your browser. Drag the weights, add layers, and watch the decision boundary move. Nothing to install, and no data leaves your device.
01 One neuron
A neuron multiplies each input by a weight, adds a bias, and squashes the sum with an activation function. Drag the sliders: the weights turn the boundary line, the bias shifts it. Points on the orange side are predicted as class 1, points on the blue side as class 0.
ŷ = σ(w₁·x + w₂·y + b)
- Accuracy
- -
- Loss
- -
02 A small network
One neuron can only draw a straight line. Hidden layers combine many lines into curves, rings and spirals. Pick a dataset, press play, and watch the network learn. Each small square shows the pattern one neuron has learned.
Output
Training loss Test loss
Class 0 Class 1
03 Things to try
- XOR with no hidden layer: the loss gets stuck, because no straight line can separate the four corners.
- Add one hidden layer with 4 neurons and play again. Now the network can bend the boundary.
- Circle with only the x² and y² features: a single neuron is enough once the inputs are right.
- Spiral is the hardest. Try 3 layers of 8 neurons or add the sin features, and lower the learning rate if the loss jumps around.
- Raise the learning rate to 3 and watch training become unstable.
04 What is happening
Each epoch, the network predicts every training point, measures its error with cross-entropy loss, and uses backpropagation to work out how much each weight contributed to that error. Gradient descent then nudges every weight a little in the direction that lowers the loss. Test loss is measured on points the network never trains on: if it climbs while training loss falls, the network is overfitting.