# Back Propagation Algorithm – An Overview

Neural networks have been the most trending word in the world of AI technology. And when talking of neural networks, back propagation is a word that should be focused on. The algorithm of back propagation is one of the fundamental blocks of the neural network. As any neural network needs to be trained for the performance of the task, backpropagation is an algorithm that is used for the training of the neural network. It is a form of an algorithm for supervised learning which is used for training perceptrons of multiple layers in an Artificial Neural Network.

Typical programming is considered where the data is inserted and the logic of the programming is performed. While the processing is done, the output is received by the user. But, this output, in a way, can influence the logic of the programming. This is what the algorithm of backpropagation does. The output will influence the logic and result in a better output.

The article will focus on the algorithm of backpropagation and its process of working.

## Importance of back propagation

The importance of backpropagation lies in its use in neural networks. The designing of neural networks requires that the weights should be initialized at the beginning only. These weights are some random values or any random variables which are considered for initializing the weights. Since the weights are randomly inserted, there is a chance that the weights might not be the correct ones. This means that the weights won’t fit the model. The output of the model might be different than the expected output. As a result, there is a high error value. But, it is always important to reduce the error, and thinking of ways to reduce the error is a challenge. The model needs to be trained that whenever these types of scenarios occur, it needs to change the parameters accordingly. And with the change of the parameters, the error value will be reduced.

Therefore, the training of the model is required, and backpropagation is one such way through which a model can be trained so that there are minimum error values.

A few steps of the backpropagation algorithm in neural networks can be summarized below:

● Error calculation: It will calculate the deviation of the model output from the actual output of the model.

● Minimum error: In this step, it will be checked whether the error generated is minimized or not.

● Parameter update: The step is meant for updating the model parameters. If the model generates a very high error value, then it needs to update its parameters,

such as the weights and the biases. The model is rechecked for the error, and the process is repeated until the generated error gets minimized.

● Final model: After a repeated process of checking and updating, the error gets minimized, and the model is now ready for the inputs. Inputs can be fed into the model, and the outputs from the model can be analyzed.

### The back propagation neural network

In any neural network, the back propagation algorithm searches for the minimum value of error. This is done through the technique of gradient descent or the delta rule, through which the minimum function of error is searched from the weight space. Once the weights are identified that reduces the error function, it is considered as the solution for the learning problem. In the 1960s, when the algorithm was introduced first and then in the later years, the popularity of the algorithm was increased. The neural network can be effectively trained through this algorithm using a method of the chain rule. If there is a forward pass through the neural network, then a backward pass is performed by the parameter of the model through its adjustment of the parameters such as biases and weights. For the back propagation algorithm to work, the neural network should be defined first.

### The neural network model

If a 4 layer model of the neural network is considered, then it will consist of the layers; the input layer, 4 neurons designed for the hidden layers, and there will be 1 neuron designed for the output layer.

Input layer: The input layer can be a simple one, or it can be a complex one. A simple input layer will contain the scalars, and a complex input layer, will consist of matrices of multidimensional or vectors. The first activation sets are considered to be equal to the input values.

By the term activation, it means the value of the neuron that results after the application of the activation function.

Hidden layers: Using certain weighted inputs such as z^l in the layers l, and the activations a^l in the same layer l. Equations are generated for these layers such as layer 2 and layer 3.

The activations for layers are computed through the use of the activation function f. The function of activation “f”, is a non-linear function that allows the learning of complex patterns present in the data by the network.

A weight matrix is formed having a shape of (n,m), where the number “n” denotes the output neurons, while the “m” denotes the input neurons of the neural network. In the model of the above mentioned layers, the number of n will be 2, and the number of m will be 4. Also, the first number in the weight’s subscript should match the index of the neuron that is in the next layer. The second number should match the neuronal index of the previous layer of the network.

Output layer: The output layer is the final layer of the neural network. It predicts the value of the model. A matrix representation is used for the simplification of the equation.

### Forwards propagation of the neural network and its evaluation

The equations generated in the defining of the neural network constitute the forward propagation of the network. It predicts the output of the model. In a forward propagation algorithm, the final step that is involved is the evaluation of the predicted output against the output that is expected. If the predicted output is “s”, and the expected output is “y”, then s is to be evaluated against y. For the training dataset (x,y), x is the input, and y is the output.

A cost function “C”, is used for the evaluation of s against y. The cost function may be a simple one like the mean squared error (MSE), or it may be a complex one, like the cross-entropy. Based on the value of the C, the model gets to know how much the parameters should be adjusted for getting closer to the output that is expected, which is y. This is done through the back propagation algorithm.

## Backpropagation algorithm

The backpropagation algorithm repeatedly does the adjustment of the weights in the network connections in order to minimize the difference between the outputs of the model to the expected output. It is also in the backpropagation algorithm that new and useful features can be created in the network.

The backpropagation algorithm also aims to decrease or minimize the defined cost function of the network i.e. C. This is done through the adjustment in the parameters such as the biases and the weights. This adjustment to be made in the parameters is determined through the cost functions gradients with respect to all those parameters.

The gradient of function C in the point x is defined as the vector of all partial derivatives that are in the cost function C in x.

The sensitivity to the change in the value of a function is measured by the derivative of the function C with respect to the change in argument x. This means that it is the derivative that tells where the cost function C is moving.

The change in the parameter x is defined by the gradient. It shows the changes that are required in the parameter x for minimizing C. The chain rule is used for computing the gradients. It is the gradient that allows the optimization of the parameters.

This is how the algorithm of backpropagation works in the improvement and the training of the neural network. It serves to be an important part of the machine learning aspects. Being an essential part of training the neural network, understanding the algorithm of backpropagation is essential. If you want to be an expert in machine learning and artificial intelligence, then you can check out the course “Master of Science in Machine Learning & Artificial Intelligence” offered by upGrad. Any working professionals are eligible for the course. You will be trained through experts faculties from IIIT Bangalore and also from LJMU. The 650+ hour’s content learning will help you in preparing yourself for the AI future ahead. Any queries regarding the course are welcome.

### What is the method that is used in the back propagation algorithm?

The method which is used in the back propagation algorithm is the chain rule.

### Why is the back propagation algorithm used?

The backpropagation algorithm is used for minimizing the error of the model.

### How does the back propagation algorithm minimize the error of the network?

The back propagation algorithm tries to adjust the parameters accordingly resulting in the minimization of the error. ×