Backpropagation

From Computer Science Wiki
Case study notes[1]

Backpropagation, or "backward propagation of errors," is a method used in artificial neural networks to calculate the gradient that is needed in the optimization process. It is used for training the network and is a key part of many machine learning algorithms. Here's a step-by-step description:

  1. Forward Pass: During this step, the network makes a prediction based on the input data. This prediction will initially be fairly inaccurate, as the network's weights are initialized randomly.
  2. Calculate Loss: The prediction is compared to the actual output, and the difference between the two is calculated. This difference is called the "loss" or "error." There are various methods to calculate this loss, but all aim to represent how far off the network's prediction was from the actual output.
  3. Backward Pass (Backpropagation): This is where backpropagation really comes into play. The network propagates the error backwards, starting from the output layer and moving through each hidden layer until it reaches the input layer. The goal is to calculate the gradient, or the rate of change of the error with respect to the weights and biases in the network. To do this, it uses the chain rule from calculus to iteratively compute these gradients for each layer.
  4. Update Weights: The final step is to use these gradients to adjust the weights and biases in the network. This is typically done using an optimization algorithm, such as stochastic gradient descent (SGD), which adjusts the weights in the opposite direction of the gradient to minimize the loss. The size of the adjustments is governed by a parameter called the "learning rate."

The above steps are repeated for a number of iterations (or "epochs") until the network is adequately trained. The end goal is to adjust the weights and biases of the network so as to minimize the error on the output, and in doing so, the network "learns" the relationship between the input data and the output data.


References[edit]