" 8 The backpropagation algorithm The goal of the backpropagation algorithm is to…
- 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:
-
Perform a “feedforward pass,” to compute h (1), h(2), h(3), ..., h(L) .
-
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
-
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
- 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:
- Perform a “feedforward pass,” to compute h (1), h(2), h(3), ..., h(L) .
- 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 backwar"
-
- Assistant
Back-propagation is a core algorithm for training neural networks, focusing on optimizing the weights and biases of the network to minimize the difference between the actual output and the desired output. The algorithm operates in a straightforward but powerful mechanism involving two main phases: the feedforward pass and the backward pass.
- User
What if now my operation of a feedforward neural network with one hidden layer can be described by: h=g\left(W^Tx+c\right), where W represents the weight matrix of the connections between the input layer and the hidden layer, c is the bias vector for the hidden layer, and g is the activation function. The output y is then computed as y=f\left(h;w,b\right)=w^Th+b, where w and b are the weight vector and bias for the connections between the hidden layer and the output layer respectively ? Change a bit of your equation's notation.
- Assistant
- User
- Assistant