Backpropagation
Computation graph, backward pass, mini-autograd
In this chapter, you will learn to
- Break a computation into a graph and send gradients backwards
- Build a tiny automatic differentiation engine
- Check that a gradient is correct
Tools: NumPy
10 exercises
Each exercise is graded automatically, in your browser. The full statements are available once you have an account.
What this is for in real life
A network has millions of settings, and to learn it must know which way to turn each one. Backpropagation answers for all of them at once, and it is what makes deep learning possible. - Every modern AI. The…
Sensors in cascade
You are calibrating a measurement chain: a signal goes through a long series of processing stages, applied one after the other. Each stage is of one of two types: -
["lin", a, b]: it turns the valuevinto…The split signal
Your measurement chain, continued. To gain finesse, the calibration bench has been rebuilt: right after the input, the signal is now duplicated and sent into two processing branches mounted in parallel. Each…
The gradient spy
You have a 2-layer network with ReLU. It produces an error on some data. You want to know: if I change one weight by a tiny bit, by how much does the error change? This is the fundamental question for training a…
The backward pass
The previous problem required forward passes for parameters. For a network with 1000 weights, that is 2000 evaluations. For a million weights, it is unusable. Challenge: find a way to compute ALL the…
The complete training
You now have a fast way to compute the gradients. What remains is to use them so that the network learns on its own. The data forms two classes arranged in concentric circles, impossible to separate with a line.…
Lesson: your own Python objects, in five moves
In the exercises that follow, you are going to build a new kind of number, one that remembers how it was computed. For that, Python lets you create your own types of objects: a class describes the blueprint, and…
The tensor that remembers
When you compute
z = x * y + win numpy, the resultzdoes not know where it came from. If you want to compute , you have to redo everything by hand. The problem: what if the*…The gradient rewinder
In the previous exercise, your
Varclass learned to remember: each result keeps track of the operation that produced it and theVars it came from. The full thread of the computation is recorded. You now want to put…The autograd network
You have an engine that computes gradients automatically. Put it to the test: can it train a neuron to classify data, without you writing a single derivative? The neuron computes…