liveBook · Manning

Gradient

As explained in Grokking Machine Learning

A vector of partial derivatives that indicates how a multivariable function changes with respect to its parameters.

When a neural network makes a prediction, its loss measures how far that prediction is from the label. The gradient is the vector of derivatives showing how that loss changes with each weight and bias. Training takes a small step opposite to the gradient to reduce the loss. section 10.2

In backpropagation, the gradient is used in a repeated training loop:

  • Calculate the loss and its gradient. section 10.2
  • Take a small step opposite to the gradient, then repeat to decrease the loss. section 10.2

The derivatives are calculated for many weights and biases, making the loss function complicated. Detailed backpropagation mathematics is deferred; Keras, TensorFlow, and PyTorch implement the algorithm in practice. section 10.2

How Grokking Machine Learning covers it

How deep it goes
Defines derivatives for each weight and bias and gives the update procedure; detailed backpropagation mathematics is deferred.
Examples
Uses neural-network loss derivatives for weights and biases, followed by small opposite-gradient updates.
What you can do after
Apply gradient descent by calculating the loss and its gradient, then stepping a small amount in the opposite direction.
How it connects
Connects gradient descent, backpropagation, neural networks, weights, biases, and loss functions.

Also explained in

Compare how 20 books explain gradient →

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.