Ch2_ANN_BB
Ch2_ANN_BB
1
Update weights
• Neural network training is about finding
weights that minimize prediction error.
3
Forward propagation
• We will use given weights and
4
Calculating Error
• Now, it’s time to find out how our
5
Reducing Error
• Our main goal of the training is to reduce the error.
• Since actual output is constant, “not changing”, the only way to reduce the error is to change prediction value.
➢ How to change prediction value?
• In order to change prediction value, we need to change weights values.
6
Backpropagation
How to update the weights value so that the error is reduced?
• Backpropagation, short for “backward propagation of errors”, is a mechanism used to update the
weights using gradient descent.
• It calculates the gradient of the error function with respect to the neural network’s weights.
• The calculation proceeds backwards through the network.
7
Backpropagation: Gradient descent
Gradient descent is an iterative optimization algorithm for finding the
minimum of a function.
In our case we want to minimize the error function.
8
Backpropagation: Update w6
• In order to update w6, we take the current w6 and subtract the partial derivative of error
function with respect to w6.
• Optionally, we multiply the derivative of the error function by a selected number to make
sure that the new updated weight is minimizing the error function; this number is called
learning rate.
9
Backpropagation: Update w6
• The derivation of the error function is evaluated by applying the chain rule as following
10
Backpropagation: Update w6 and w5
• Similarly, we can derive the update formula for w5 and any other weights
existing between the output and the hidden layer.
11
Backpropagation: Update w1
• However, when moving backward to update w1, w2, w3 and w4 existing between input and hidden layer, the
partial derivative for the error function with respect to w1, for example, will be as following.
12
Backpropagation: Update wi
• We can find the update formula for the remaining weights w2, w3 and w4 in the same way.
• In summary, the update formulas for all weights will be as following:
13
Backpropagation: Update wi
• We can rewrite the update formulas in matrices as following:
14
Backward Pass
• Using derived formulas we can find the new weights.
15
• Now, using the new weights
we will repeat the forward
passed.
16