Checkpoint
Neural networks from scratch
Twelve questions across the whole module: layers and their parameters, why the nonlinearity matters, softmax and cross-entropy, backpropagation through a linear layer, and reading and optimizing a training run. The numbers are new, and several questions aim at the classic confusions. Work on paper before answering. You need 80% to pass.
- 1
How many parameters, weights and biases together, does a network with layer sizes 100-64-64-5 have?
parameters - 2
In the column convention, a network computes and then , with no activation and no biases, where
Find the single matrix with for every .
A - 3
A layer computes with
Compute .
h - 4
Compute , to 3 decimal places.
p - 5
A 10-class classifier reports a cross-entropy loss of 23.0 on its very first batch, before any update. What is the most likely explanation?
- 6
A character-level language model has a mean cross-entropy of 1.5 nats per character on validation text. What is its perplexity? Give 2 decimal places.
perplexity - 7
A classifier outputs logits , and the correct class is the first one. The loss is softmax followed by cross-entropy. Find .
∂L/∂z - 8
A layer receives a batch of two examples with three inputs, and backprop delivers :
Find .
∂L/∂W - 9
A graph computes and from the same input, then . Backpropagate to find at .
dL/dx - 10
A training run's loss falls for 200 steps, then starts jumping up and down by large amounts, and becomes nan at step 350. What should you try first?
- 11
Adam runs with and the default , . At the very first step, one parameter's gradient is . By how much does that parameter change? Ignore and give the size of the change.
size of the change - 12
Code it Write
linear_backward(X, W, dY)for a layer in the row convention. Return the tuple(dX, dW, db), with the shapes ofX,Wandb.