Interactive demo · Bayesian and Probabilistic Machine Learning · Chapter 5

Backpropagation: a two-layer network, over-fitting, weight decay and early stopping

A network with M tanh hidden units and one linear output, y(x) = b + Σj wj tanh(aj(x)), is trained by full-batch gradient descent (Adam) on the sum-of-squares error, with the gradient computed by backpropagation. The dashed curves are the outputs zj = tanh(aj) of the individual hidden units (rescaled to fit the plot); the red curve is the network function. The lower right panel compares every backpropagated derivative with a central finite difference.

Target function

Hidden units M

Training points N

Noise sd

Weight decay λ

Step size

Try these

Data: x uniform on (0, 1) for sin(2πx) and on (−1, 1) for the other targets, plus Gaussian noise with the chosen standard deviation. Training minimises E(w)/N + (λ/2)‖w‖2 with Adam, full batch, from weights drawn N(0, 1) (first layer) and N(0, 1/M) (second layer); the error curves show the RMS error √(2E/N). All random numbers are seeded, so a class sees the same pictures.

In the lecture notes