A neural network can be described as a series of altering linear transformations and elementwise nonlinearities.
is a “sigmoid function”, usually or .
You present input and get output . You have some loss function that says how much you like that particular ouput on that input. Backpropagation is an algorithm for calculating the derivatives of with respect to all the weight matrices . Backprop is a special case of reverse-mode automatic differentiation. However, it is simple enough to implement manually that it is often worth doing so for efficiency.
The loss function will directly give the derivatives with respect to the output. This will be either (depending on the application)
The algorithm follows easily from applying the following three rules (Here, denotes the elementwise product):
Notice that applying these rules in reverse will have the same complexity as the original “forward propagation”.