Neural network trainer
Build a real neural network, train it in your browser and watch it learn, underfit and overfit. About this simulator
About this simulator and how it works
Free demo: level 1 (4 jobs). Levels 2 to 4 (activations and depth, overfitting, and the engineer challenges) are in the full version.
Sort orange dots from blue dots by building and training a small neural network. Change the layers, neurons, activation, learning rate, inputs and regularisation, press Train and watch the decision boundary and the loss curves move as it learns. Then submit it to a hidden test set it has never seen.
How it works
- The data: each dot has two measurements, x₁ and x₂, and a label (orange = 1, blue = 0). The filled dots are the training set the network learns from. The ringed dots are a separate validation set (100 points) you can watch but the network never trains on. When you press Submit model, it is marked on a hidden test set of 1,000 new points from the same source, which is how models are judged in practice.
- The picture: the background shows the network's output at every point: orange where it predicts 1, blue where it predicts 0, stronger colour where it is more confident. The white line is where its output crosses 50%. Tap any hidden neuron on the network diagram to see that neuron's own output instead.
- The chart: the loss on the training points (solid) and the validation points (dashed) after every epoch (one pass through the training set). When the dashed line turns up while the solid line keeps falling, the network is overfitting.
- Each job gives up to three stars. The first star is always the main goal on the hidden test set. Changing the network's shape, activation or inputs builds a new network with new random weights; changing the learning rate, optimiser, batch size or L2 keeps the weights you have.
How accurate is it?
Everything you see is a real neural network training in your browser, written from scratch with no libraries. Nothing is pre-recorded and no result is faked: if it learns, it learned.
- Model: a fully connected feed-forward network (a multilayer perceptron) with 0 to 4 hidden layers of 1 to 8 neurons, a sigmoid output neuron and the activation you choose in the hidden layers (ReLU, tanh, sigmoid or linear).
- Training: the loss is binary cross-entropy (log loss), averaged over each minibatch. Gradients come from backpropagation (checked against numerical gradients in our tests). Plain SGD updates each weight by learning rate × gradient. Adam uses the standard settings from Kingma and Ba (2015): β₁ = 0.9, β₂ = 0.999, ε = 10⁻⁸, with bias correction.
- L2 regularisation: adds λ × (sum of all squared weights) to the loss, so each weight is pulled towards zero by 2λw on every step. Biases are not penalised. The loss figures shown are the cross-entropy without the penalty.
- Starting weights: He initialisation for ReLU layers and Glorot (Xavier) initialisation otherwise, the usual defaults in real frameworks. Each ↺ Reset picks new random starting weights, so two runs with the same settings can end differently, just as in real training.
- Accuracy counts a prediction of 50% or more as orange. Test loss rewards a model for being right and confident, and punishes it heavily for being confident and wrong.
What it simplifies: the data is two-dimensional so you can see it, the networks are tiny (real ones have millions or billions of parameters), and it trains on your computer's processor in double precision rather than on a graphics card. The ideas carry over unchanged: capacity, learning rate, vanishing gradients, overfitting, regularisation, early stopping and the need for a held-out test set are exactly what engineers deal with on large models.