Back-propagation

The goal when training neural networks, is to find the optimal values of the weights and biases that minimize the cost function. When using gradient descent to achieve this goal, one has to find the derivative of the cost with respect to every parameter in the network which is extremely compute expensive

Back-propagation is a technique that is central to neural network training and optimization. In combination with gradient descent, it provides a way for the error to propagate backward through the network and to compute the rate at which each neuron contributes to the overall loss.

How to compute back-propagation:

An easy way to understand back propagation is to represent your neural network using a computational graph.
Picture the neural network below. It has two inputs; x1 x2 , a single hidden layer with two neurons and finally an output layer with two outputs

Simple Neural Network

Two inputs, a single hidden layer with two neurons, and two outputs

w₁₁ w₂₁ w₁₂ w₂₂ w₃₁ w₄₁ w₃₂ w₄₂ X₁ X₂ H₁ H₂ Y₁ Y₂ INPUT HIDDEN OUTPUT

Focusing our attention on one neuron in the output layer

In calculus, the rate of change of a function of a function is the multiple of the derivative of those functions, no matter how composite the functions are, we just keep multiplying.

Even though the weight w111w_{11}^{1} is not directly connected to the cost function, it is connected through intermediate nodes and changes in its value affect the cost function through the chain rule of calculus. Because we cant compute directly how much the cost is affected by the weight, we then use the chain rule of calculus.

The derivative of the cost w.r.t to the weight w11w_{11} at input x1x_{1}:

∂C∂w11=∂C∂a1∂a1∂z∂z∂w11\frac {\partial C}{\partial w_{11}} = \frac {\partial C}{\partial a_1} \frac {\partial a_1}{\partial z} \frac {\partial z}{\partial w_{11}}

The derivative of the cost w.r.t to the bias b1b_{1} at input x1x_{1}:

∂C∂b1=∂C∂a1∂a1∂z∂z∂b1\frac {\partial C}{\partial b_{1}} = \frac {\partial C}{\partial a_1} \frac {\partial a_1}{\partial z} \frac {\partial z}{\partial b_{1}}

The derivative of the cost w.r.t to the bias b2b_{2} at input x2x_{2}:

∂C∂b2=∂C∂a1∂a1∂z∂z∂b2\frac {\partial C}{\partial b_{2}} = \frac {\partial C}{\partial a_1} \frac {\partial a_1}{\partial z} \frac {\partial z}{\partial b_{2}}

As we have seen, back-propagation is the repeated application of the chain rule of differentiation. We do this for every weight and bias in the network.

This whole process of backtracking through the network is called back-propagation

To update the different parameters of the network, we subtract the learning rate from the different rate of changes. This process is repeated until an optimal value of the cost functions is found. The learning rate introduces stability and determines the adjustments magnitude

In summary, we use back-propagation to compute the change and use gradient descent to update the values of the weight and bias.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *