“8 The backpropagation algorithm The goal of the backpropagation algorithm is to compute…
- User
“8 The backpropagation algorithm The goal of the backpropagation algorithm is to compute the gradient (a vector of partial derivatives) of an objective function with respect to the parameters in a neural network. As the decision function h(x) of the neural network is a function of functions, we need to use the chain rule to compute its gradient. The backpropagation algorithm is indeed an implementation of the chain rule specifically designed for neural networks. It takes some effort to arrive at this algorithm, so I will skip the derivation, and just show you the algorithm. To begin, let’s simplify the notations a little bit. We will use θ for all the weights in the network and b for all the biases. θ (l) ij means weight at layer l-th connecting neuron (or input) j-th to the neuron i-th in layer l + 1, b (l) i is bias of neuron i. The layers are indexed by 1(input), 2, …, L(output). The number of neurons in the layer l is sl . In this notation, the decision function h(x) can be recursively computed as: h (1) = x h (2) = g θ (1)T h (1) + b (1) … h (L−1) = g θ (L−2)T h (L−2) + b (L−2) h(x) = h (L) = g θ (L−1)T h (L−1) + b (L−1) [this is a scalar] We use matrix-vectorial notations so that it is easier to read and note that h (l−1) is a vector. Here’s the backpropagation algorithm. The steps are: 1. Perform a “feedforward pass,” to compute h (1), h(2), h(3), …, h(L) . 2. For the output layer, compute δ (L) 1 = 2(h (L) − y) g 0 sXL−1 j=1 θ (L−1) 1j h (L−1) j + b (L−1) 1 3. Perform a “backward pass,” for l = L − 1, L − 2, …, 2 For each node i in layer l, compute δ (l) i = sXl+1 j=1 θ (l) ji δ (l+1) j g 0 sXl−1 j=1 θ (l−1) ij h (l−1) j + b (l−1) i 4. The desired partial derivatives can be computed as ∆θ (l) ij = h (l) j δ (l+1) i ∆b (l) i = δ (l+1) i The indices make the algorithm look a little busy. But we can simplify these equations by using more matrix-vectorial notations. Before we proceed, let’s use the notation for element-wise dot product. That is if b and c are vectors of n dimensions, then bc is a vector a of n dimensions where ai = bici , ∀i ∈ 1, …, n. Using this notation, the algorithm above can be rewritten in the following vectorized version: 1. Perform a “feedforward pass,” to compute h (1), h(2), h(3), …, h(L) . 2. For the output layer, compute δ (L) 1 = 2 h (L) − y g 0 θ (L−1)T h (L−1) + b (L−1) 3. Perform a “backward pass,” for l = L − 1, L − 2, …, 2 For each note i in layer l, compute δ (l) = θ (l) T δ (l+1) g 0 θ (l−1)T h (l−1) + b (l−1) 4. The desired partial derivatives can be computed as ∆θ (l) = δ (l+1) h (l) T [uvT is also known as the cross product of u and v] ∆b (l) = δ (l+1) A nice property of the backpropagation algorithm is that it can be made efficient because in the feedforward pass, some of the intermediate values can be cached, and then used to compute the gradient in the backward” Mathematically explain the above basic principle of back-propagation for neural network training with equations step by step in detail, try to use your own words, do not directly copy the sentence from the above paper.
- Assistant