Neural Network Playground Guide
Interactive tool: playground.hakyimlab.org
What Is This?
The Neural Network Playground is an interactive visualization that lets you build and train a neural network in your browser — no code required. You choose a dataset (a 2D scatter plot of points belonging to two classes: blue and orange), configure a network architecture (how many layers, how many neurons), and watch the model learn in real time.
How it works: The network takes two input variables (X₁ and X₂ — the x and y coordinates of each point) and tries to learn a rule that separates the blue points from the orange points. You press play and watch the network update its weights through gradient descent, epoch by epoch.
Reading the output (right panel): The large colored plot on the right shows the network’s prediction across the entire 2D space. The background color is the model’s classification:
- Blue regions — the model predicts “blue class” here
- Orange regions — the model predicts “orange class” here
- Color intensity — how confident the model is. Deep blue/orange = high confidence. Pale/white = the model is uncertain (near the decision boundary)
- Dots — the actual data points. A well-trained model will have blue dots in blue regions and orange dots in orange regions.
Reading the neurons (middle panel): Each small square inside the network shows what that individual neuron has learned — its own mini decision boundary. Early-layer neurons learn simple splits (lines), while later-layer neurons combine those splits into more complex boundaries. Hover over any neuron to see its output enlarged.
Reading the weights (connecting lines): The lines between neurons represent learned weights. Blue lines = positive weights, orange lines = negative weights, and line thickness = weight magnitude. Thick lines mean that connection matters a lot to the output.
Top Bar — Training Controls
Left Panel — Data
Middle Panel — Network Architecture
Right Panel — Output
Things to Try
- Why activation matters: Set activation to Linear, add multiple layers → still can’t solve circle. Switch to ReLU → solves it immediately.
- Overfitting demo: Use spiral dataset with low noise, train a large network (6 layers, 8 neurons each) → training loss near zero, test loss much higher. Then add L2 regularization.
- Learning rate extremes: Set learning rate to 1.0 → watch loss explode. Set to 0.00001 → watch it barely move after 1000 epochs.
- Feature engineering vs depth: Solve circle with just X₁² + X₂² features and zero hidden layers. Then solve it with raw X₁, X₂ and two hidden layers. Same result, different approach — the network learned the transformation.
- Universal approximation: Use 1 hidden layer with increasing neurons (2 → 4 → 8 → 16) on the spiral dataset to see how width helps.