Project 7 of 14, for Neil
Seeing Forecaster
A network that forecasts the seeing for Neil's stargazing nights from the weather, taught not to memorise: Riya's fits 24 nights perfectly and the rest badly, until weight decay, dropout, early stopping and batch norm teach it to hold back.
Sign up free to open itLog in
Act 7 needs a free account, so your work is saved as you go. Act 1 is open to everyone.
The brief
- NeilBefore every stargazing night I rate the seeing, which is how much the stars shimmer, in arcseconds.
- RiyaI've trained a network on it and the training loss is zero.
- NeilOkay, and on the nights it hasn't seen?
In regular.py, add three regularisers to the seeing network in net.py, and compare them on the nights it never learnt from.
dropout_mask(shape, rate, rng): an array of that shape in which each entry is 0 with chancerate, and otherwise1 / (1 - rate).with_weight_decay(grads, params, decay): a new dict of gradients, withdecaytimes each weight matrix added to its gradient. The biases,b1andb2, are left alone.train(X, T, X_val, T_val, params, rate, epochs, decay=0.0, drop=0.0, patience=None, seed=0): gradient descent that changesparamsin place. Each epoch: a fresh dropout mask for the hidden layer ifdropis above 0, one step with weight decay, then the training and validation losses with no mask. Withpatience, stop once the validation loss hasn't improved forpatienceepochs, and put the best epoch's weights back. It returns the training losses, the validation losses and the best epoch.- Run as a program, it compares Riya's network with each regulariser.
- In
batchnorm.py,batch_normfor training and for evaluation.
training validation Riya's 0.0000 0.2455 weight decay 0.02 0.0451 0.1340 dropout 0.5 0.0106 0.1890 early stopping 0.0603 0.1842 Guessing the average 0.4213
What you learn
What's in it
- Perfect, on paper
- Stop while it's best
- How Paul would do it
- Fix Riya's version
- Rent on every weight
- A weight nobody needs
- Half asleep, on purpose
- Half asleep
- Three ways to hold back
- Every neuron on one scale
- An average evening
- Batch norm, properly
- Ship it