liveBook · Manning

Optimization

As explained in Math and Architectures of Deep Learning

A training component that updates model parameters according to a chosen optimization rule such as SGD.

Optimization is the iterative process of minimizing a loss function by adjusting neural-network weights. Different optimization algorithms determine how those updates proceed, including SGD, momentum, Nesterov, AdaGrad, and Adam. section 9.0

With a fixed architecture, training learns the connector weights that produce useful class boundaries. The loss measures departure from desired outputs; optimization repeatedly moves the weights toward lower loss. section 9.0

A PyTorch SGD training step follows this sequence:

  • Compute model scores for each batch and evaluate the loss. section 9.2.3
  • Clear previous gradients, backpropagate the loss, and update weights in the negative-gradient direction. section 9.2.3
  • Repeat the loop across batches and epochs; initialization and learning rate affect convergence. section 9.2.3

Statsville classifier

A small PyTorch classifier uses CrossEntropyLoss and SGD with a learning rate of 0.02. Its training loop reduces loss across epochs while predictions become more accurate for the three height-and-weight classes. section 9.2.3

Figure 9.6 Height and weight of various Statsville residents. Class 0 (man) is represented by the right-most cluster, class 1 (woman) by the middle cluster, and class 2 (child) by the left-most cluster.

Use the class-cluster visualization to connect parameter updates and decreasing loss with changing classification regions. section 9.2.3

How Math and Architectures of Deep Learning covers it

How deep it goes
Explains the objective conceptually and implements SGD through batching, gradient clearing, backpropagation, and parameter updates.
Examples
Demonstrates SGD with a PyTorch classifier trained on Statsville height-and-weight clusters.
What it assumes
Assumes a neural-network classifier, labeled data, model outputs, and a loss function while connecting them through training.
What you can do after
Apply optimization via PyTorch by configuring SGD and running a gradient-based training loop.
How it connects
Connects optimization with loss functions, neural networks, gradient descent, softmax, regularization, and dropout.

Also explained in

Compare how 30 books explain optimization →

Related concepts

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