liveBook · Manning

Chapter 8: Training neural networks: Forward propagation and backpropagation

What you will learn in chapter 8 of Math and Architectures of Deep Learning

This chapter introduces supervised neural-network training as fitting MLP parameters from labeled input-output examples, then previews the mathematical tools used to do it.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This chapter introduces supervised neural-network training as fitting MLP parameters from labeled input-output examples, then previews the mathematical tools used to do it.

Key terms: training data, supervised neural networks, labeling, input-output pairs, training, parameter values, multilayer perceptron, MLP, neural network, training inputs

8.1 Differentiable step-like functions

This section introduces differentiable step-like activations as trainable replacements for the perceptron’s nondifferentiable Heaviside step function.

Key terms: Heaviside step function, discontinuity, differentiable, gradient vector, loss function, partial derivatives, differentiable step-like functions, sigmoid function

8.1.1 Sigmoid function

This section introduces the differentiable sigmoid as an S-shaped, parameterized approximation to a step function and explains its key algebraic and derivative properties.

Key terms: sigmoid function, parameterized sigmoid function, w, b, Heaviside step function, differentiable, large w, sigmoid, sigmoid of negative x, derivative of sigmoid

8.1.2 Tanh function

This section presents tanh as a zero-centered sigmoid-like activation whose stronger near-zero gradients can speed neural-network training on standardized inputs.

Key terms: hyperbolic tangent, tanh, sigmoid function, derivative, gradient, weight updates, convergence, sigmoid, centered around 0, standardize

8.2 Why layering?

This section explains how successive-layer connectivity simplifies MLPs and why multiple nonlinear layers can model complex functions more efficiently than a single hidden layer.

Key terms: layered network, MLP, preceding layer, successive layers, single hidden layer, perceptrons, Cybenko’s theorem, modeling efficiency, nonlinearity, nonlinear function

8.3 Linear layers

This section introduces the linear, or fully connected, layer as the basic MLP layer and establishes its connection and weight notation.

Key terms: linear layer, fully connected layer, perceptron, neuron, MLP, m, n, mn connections, weights, w_jk^(l)

8.3.1 Linear layers expressed as matrix-vector multiplication

This section expresses every neuron in an MLP layer, and then the entire layer, as weighted activations computed compactly with matrix-vector multiplication and an elementwise sigmoid.

Key terms: activation, perceptron, weighted sum, bias, sigmoid function, layer l, matrix-vector multiplication, weight matrix, W^(l), activation vector

8.3.2 Forward propagation and grand output functions for an MLP of linear layers

This section explains that an MLP of linear layers computes its final, or grand, output by evaluating each layer sequentially from the previous layer's output rather than explicitly expanding the full nested expression.

Key terms: forward propagation, linear layers, fully connected layers, grand output, MLP, previous layer, current layer, memory

8.4 Training and backpropagation

This section introduces neural-network training as iterative gradient-based adjustment of weights and biases to minimize loss across held-out-evaluated training data.

Key terms: training, parameters, weights, biases, ground truth, MLP, loss, error, mean squared error, MSE

8.4.1 Loss and its minimization: Goal of training

This section defines neural-network training as minimizing loss over training input–ground-truth pairs by choosing all layer weights and biases, motivating iterative gradient descent.

Key terms: training data set, ground-truth output, loss, MLP, weight matrix, rasterize, weight vector, bias vector, training, minimize loss

8.4.2 Loss surface and gradient descent

This section presents loss minimization as moving through parameter space along the negative loss gradient and gives the iterative weight and bias update rule for gradient descent.

Key terms: loss function, loss surface, parameter space, weights, biases, gradient, negative gradient, gradient descent, minimum, partial derivatives

8.4.3 Why a gradient provides the best direction for descent

This section uses a local Taylor approximation to show that the negative gradient is the direction of greatest immediate loss decrease and introduces the learning rate as its step size.

Key terms: gradient, negative gradient, gradient descent, loss, dot product, multidimensional Taylor expansion, Hessian matrix, offset, local approximation, quadratic terms

8.4.4 Gradient descent and local minima

This section explains why gradient descent may settle in a local minimum and why modern neural-network training often accepts that result or retrains from a new random start.

Key terms: local minimum, global minimum, gradient descent, retrain, random position, simulated annealing

8.4.5 The backpropagation algorithm

This section derives backpropagation as a layer-by-layer reverse procedure for computing loss gradients and updating an MLP's weights and biases.

Key terms: auxiliary variable, δ, pre-activation output, loss, chain rule, forward pass, forward propagation, backpropagation, last layer, gradient

8.4.6 Putting it all together: Overall training algorithm

This subsection brings forward propagation, MSE loss, and backpropagated parameter gradients together as the components of neural-network training.

Key terms: forward propagation, output prediction, MSE loss, 𝕃, ground truth, y

8.5 Training a neural network in PyTorch

This section implements demand-prediction neural-network training in PyTorch, from preparing data and defining a model through automatic differentiation, optimization, and prediction.

Key terms: regression problem, prev_week_sales, discount_fraction, weeks_to_next_holidays, input vector, X, min-max normalization, normalized data, local minimum, torch.nn.Module

8.6 Summary

This summary recaps differentiable perceptrons, layered MLP structure, and training through loss minimization with forward and backward propagation.

Where this is used later

Concepts explained in this chapter

← Chapter 7: Function approximation: How neural networks model the world Chapter 9: Loss, optimization, and regularization →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.