Labs · Neural Networks

Overfitting & Regularization

Overfitting & Regularization simulation

A big enough network can memorise anything, including the noise. Here the data is split in two: the network trains only on the training points (filled) and is checked on unseen test points (hollow). As training goes on, training loss keeps falling, but test loss eventually turns back up. The decision boundary has started wrapping around individual noisy points.

L2 regularization (weight decay) shrinks every weight a little each step, preferring simpler, smoother functions. With the right amount, both losses stay low together.

Run with λ = 0 until the test loss (pink) rises, then press "Restart" with λ around 0.002.

Controls

Evolved from Neural Network Playground.