Neural Network Playground
Train a small classifier, compare training and holdout results, and inspect one real gradient update.
About this tool
Model. Two hidden layers with the selected activation feed a two-class Softmax output. Cross-entropy uses natural logarithms and is calculated stably from logits. Weights initially follow U(−√(2/fan-in), √(2/fan-in)); biases start at zero. The five synthetic datasets keep their original coordinates and noise.
Training and holdout. Each dataset has 180 points. Within each class, a seeded shuffle assigns floor(80%) to training and the rest to holdout. Reported losses are separate mean data losses; accuracy is the correct fraction. Holdout examples never enter SGD. Viewing holdout results while choosing settings limits their value as an independent generalization test. Blobs has two class-0 clusters and one class-1 cluster.
Updates and regularization. SGD samples training points with replacement. One update pauses and processes exactly one example; continuous training uses eight updates per batch. The objective is mean training CE + λ[αΣ|w| + (1−α)Σw²]. Only weights are regularized. α = 0 selects squared L2, α = 1 selects L1; sign(0) = 0 is the chosen L1 subgradient. Learning rate 0 records updates without changing weights. A batch is published only after its updates and both metric sets are finite.
Inspector. The last example's output, loss and gradient norms describe the state before its update. One weight shows data and regularization gradients, learning rate and actual before/after values. It is chosen by the largest absolute total gradient, with lexicographic ties. The main metrics and probability plot describe the state after the batch.
Reproducibility. Separate seeded streams control data, initialization, splitting and sample selection. Reset restores the initial model and pauses. Every parameter edit invalidates the run; input drafts survive navigation. Hidden views suspend training without catching up. With reduced motion, a fresh Train prepares a paused initial model. The plot uses blue for class 0, red for class 1, circles/triangles for classes and filled/hollow markers for training/holdout; all data fit the model axes.
Reference. Cross-entropy from class logits. This browser model uses the repository's own small network core.
Only input values are remembered in this browser. Calculated results and experiment histories are not saved.