Natural Language Processing · free preview

Backpropagation and Training

Computation graphs, the chain rule run backwards, activation derivatives, cross-entropy at the output, gradient checking, and a trained XOR network.

1. Backpropagation and Training

Backpropagation and Training

2. Backprop for a two-layer network

Backprop for a two-layer network

3. Backward differentiation in NumPy

Backward differentiation in NumPy

4. One backward step

On the graph d=4ad = 4a, e=d+ce = d + c, L=b⋅eL = b \cdot e with values a=3a = 3, b=2b = 2, c=4c = 4, compute ∂L∂a\frac{\partial L}{\partial a} by the chain rule. Answer as a decimal.

5. Sigmoid derivative at a point

Compute dσdz\frac{d\sigma}{dz} at z=−0.5z = -0.5, using σ(z)(1−σ(z))\sigma(z)(1 - \sigma(z)), and round to three decimals.

6. Through the ReLU gate

The output error is δ[2]=0.4\delta^{[2]} = 0.4, the output weight feeding hidden unit 1 is w=−0.5w = -0.5, and that hidden unit received pre-activation z=0.5z = 0.5. Compute δ[1]=w⋅δ[2]⋅1[z>0]\delta^{[1]} = w \cdot \delta^{[2]} \cdot \mathbb{1}[z > 0] as a decimal.

7. The error at the output

For a sigmoid output unit with cross-entropy loss, what is the error signal δ=∂L∂z\delta = \frac{{\partial L}}{{\partial z}} at the output logit, and why is it so clean?

8. Certifying the backward pass

A hand-written backward pass produces analytic gradients. Which procedure validates them, and what outcome should it produce?

Practice this interactively

Free account · instant grading · spaced review that schedules itself.

Start this course for free