liveBook · Manning

Backpropagation

As explained in Grokking Machine Learning

A neural-network training technique that computes loss derivatives with respect to model parameters by propagating error information backward through the network.

Backpropagation trains a neural network by measuring its error, calculating how every weight and bias contributed to that error, and adjusting them to improve future predictions. It combines the intuition of correcting connected classifiers with gradient descent: the loss gradient points toward increasing error, so training takes a small step in the opposite direction. section 10.2 section 10.6

A training iteration follows this compact procedure:

  • Initialize the network with random weights and biases. section 10.2
  • Calculate predictions, the loss function, and its derivatives with respect to every weight and bias. section 10.2
  • Update the parameters by taking a small step opposite the gradient. section 10.2
  • Repeat the process across epochs and batches while monitoring loss and accuracy. section 10.3

A small classifier in Keras

A two-feature dataset is classified with two hidden layers, ReLU activations, dropout, and a softmax output. Calling model.fit(..., epochs=100, batch_size=10) runs repeated backpropagation; training loss falls from 0.5473 to 0.2110 while accuracy reaches 0.9000. Testing accuracy should still be measured separately. section 10.3

Figure 10.16 A mental picture of backpropagation. At each step of the training process, the weights of the edges are updated. If a classifier is good, its weight gets increased by a small amount, and if it is bad, its weight gets decreased.

Visualizes backpropagation as repeated edge-weight updates: useful weights increase slightly and unhelpful weights decrease slightly. section 10.2

How Grokking Machine Learning covers it

How deep it goes
Defines the algorithm and gives pseudocode, while deferring detailed one-hidden-layer derivative mathematics to an appendix.
Examples
Uses a circular two-feature classifier and MNIST handwritten-digit recognition with Keras training runs.
What it assumes
Assumes familiarity with gradient descent and classifiers, while explaining neural-network loss gradients and parameter updates.
What you can do after
Apply it via Keras by defining a neural-network architecture, loss, optimizer, epochs, and batch size.
How it connects
Connects neural networks with gradient descent, loss functions, weights, biases, vanishing gradients, regularization, and dropout.

Also explained in

Compare how 17 books explain backpropagation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.