Backpropagation is the main method of training a Feedforward Neural Network through Gradient Descent.
Motivation: Chain Rule
The motivation behind backpropagation is a dependency network for calculating complex multivariate chain rule derivatives.
For example:
We can then represent the partial derivatives of one of the functions as:
Hence:
So we can then have the edges:
Showing the multivariate dependencies.
Example
Note - to save computation, we can cache backpropagated paths.
Considering a neural network, we can calculate the backpropagated loss values for a given node by summing the products of the partial derivatives of the paths to that node from the output.
Hence, consider the following network with inputs , target and Loss Function :
Suppose we wish to calculate the error derivative .
Assume forward propagation has occurred, hence:
We then find the paths leading , of which there is only one. We then note the functions that lie on this path:
We then determine their local partial derivatives:
\begin{align} \partial L_\hat{y} &= \hat{y}-y \\ \partial \hat{y}_{z_3} &= \hat{y}(1-\hat{y}) \\ \partial z_{3}{a_1} &= w_7 \\ \partial a_1z_1 &= 1-a_1^2 \\ \partial z_1w_5 &= x_3 \end{align}We can then simply take the product of the partial derivatives (and input the cached values):