0% found this document useful (0 votes)
30 views4 pages

Back Propagation Algorithm Explained

The Back Propagation algorithm, or 'Backward Propagation of Errors', is a method for training neural networks by minimizing the difference between predicted and actual outputs through iterative adjustments of weights and biases. It consists of a Forward Pass, where inputs are processed through layers, and a Backward Pass, where errors are propagated back to update weights using gradients. This process automates learning and scales well to complex architectures, making it essential for deep learning applications.

Uploaded by

mahiphilip88
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views4 pages

Back Propagation Algorithm Explained

The Back Propagation algorithm, or 'Backward Propagation of Errors', is a method for training neural networks by minimizing the difference between predicted and actual outputs through iterative adjustments of weights and biases. It consists of a Forward Pass, where inputs are processed through layers, and a Backward Pass, where errors are propagated back to update weights using gradients. This process automates learning and scales well to complex architectures, making it essential for deep learning applications.

Uploaded by

mahiphilip88
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Back Propagation Algorithm

Back Propagation is also known as "Backward Propagation of Errors" is a method


used to train neural network . Its goal is to reduce the difference between the model’s
predicted output and the actual output by adjusting the weights and biases in the network.
It works iteratively to adjust weights and bias to minimize the cost function. In each epoch
the model adapts these parameters by reducing loss by following the error gradient. It often
uses optimization algorithms like gradient descent or stochastic gradient descent. The
algorithm computes the gradient using the chain rule from calculus allowing it to
effectively navigate complex layers in the neural network to minimize the cost function.

Fig(a)
A simple illustration of how the backpropagation works by adjustments of weights
Back Propagation plays a critical role in how neural networks improve over time. Here's
why:
1. Efficient Weight Update: It computes the gradient of the loss function with respect to
each weight using the chain rule making it possible to update weights efficiently.
2. Scalability: The Back Propagation algorithm scales well to networks with multiple
layers and complex architectures making deep learning feasible.
3. Automated Learning: With Back Propagation the learning process becomes automated
and the model can adjust itself to optimize its performance.
Working of Back Propagation Algorithm
The Back Propagation algorithm involves two main steps: the Forward Pass and
the Backward Pass.
1. Forward Pass Work
In forward pass the input data is fed into the input layer. These inputs combined with their
respective weights are passed to hidden layers. For example in a network with two hidden
layers (h1 and h2) the output from h1 serves as the input to h2. Before applying an
activation function, a bias is added to the weighted inputs.
Each hidden layer computes the weighted sum (`a`) of the inputs then applies an activation
function like ReLU (Rectified Linear Unit) to obtain the output (`o`). The output is passed
to the next layer where an activation function such as softmax converts the weighted

outputs into probabilities for classification.


2. Backward Pass
In the backward pass the error (the difference between the predicted and actual output) is
propagated back through the network to adjust the weights and biases. One common
method for error calculation is the Mean Squared Error (MSE) given by:
MSE=(Predicted Output−Actual Output)2MSE=(Predicted Output−Actual Output)2
Once the error is calculated the network adjusts weights using gradients which are
computed with the chain rule. These gradients indicate how much each weight and bias
should be adjusted to minimize the error in the next iteration. The backward pass continues
layer by layer ensuring that the network learns and improves its performance. The
activation function through its derivative plays a crucial role in computing these gradients
during Back Propagation.
Example of Back Propagation in Machine Learning
Let’s walk through an example of Back Propagation in machine learning. Assume the
neurons use the sigmoid activation function for the forward and backward pass. The target
output is 0.5 and the learning rate is 1.

Forward Propagation
1. Initial Calculation

aj=∑(wi,j∗xi
The weighted sum at each node is calculated using:

aj=∑(wi,j∗xi)
Where,
 ajaj is the weighted sum of all the inputs and weights at each node
 wi,jwi,j represents the weights between the ithithinput and the jthjth neuron
 xixi represents the value of the ithith input
O (output): After applying the activation function to a, we get the output of the neuron:
ojoj = activation function(ajaj)
2. Sigmoid Function
The sigmoid function returns a value between 0 and 1, introducing non-linearity into the
model. yj=1
3. Computing Outputs
At h1 node
a1=(w1,1x1)+(w2,1x2)=(0.2∗0.35)+(0.2∗0.7)=0.21a1=(w1,1x1)+(w2,1x2
)=(0.2∗0.35)+(0.2∗0.7)=0.21
Once we calculated the a1 value, we can now proceed to find the y3 value:
yj=F(aj)=11+e−a1yj=F(aj)=1+e−a11
y3=F(0.21)=11+e−0.21y3=F(0.21)=1+e−0.211
y3=0.56y3=0.56
Similarly find the values of y4 at h2 and y5 at O3

∗x2)=(0.3∗0.35)+(0.3∗0.7)=0.315
a2=(w1,2∗x1)+(w2,2∗x2)=(0.3∗0.35)+(0.3∗0.7)=0.315a2=(w1,2∗x1)+(w2,2

y4=F(0.315)=11+e−0.315y4=F(0.315)=1+e−0.3151
a3=(w1,3∗y3)+(w2,3∗y4)=(0.3∗0.57)+(0.9∗0.59)=0.702a3=(w1,3∗y3)+
(w2,3∗y4)=(0.3∗0.57)+(0.9∗0.59)=0.702
y5=F(0.702)=11+e−0.702=0.67y5=F(0.702)=1+e−0.7021=0.67

Values of y3, y4 and y5


4. Error Calculation
Our actual output is 0.5 but we obtained 0.67. To calculate the error we can use the below
formula:
Errorj=ytarget−y5Errorj=ytarget−y5
=> 0.5−0.67=−0.17=> 0.5−0.67=−0.17
Using this error value we will be backpropagating.

Back Propagation
1. Calculating Gradients
The change in each weight is calculated as:
Δwij=η×δj×OjΔwij=η×δj×Oj
Where:
 δjδj is the error term for each unit,
 ηη is the learning rate.
2. Output Unit Error
For O3:
δ5=y5(1−y5)(ytarget−y5)
δ5=y5(1−y5)(ytarget−y5)
=0.67(1−0.67)(−0.17)=−0.0376=0.67(1−0.67)(−0.17)=−0.0376
3. Hidden Unit Error
For h1:
δ3=y3(1−y3)(w1,3×δ5)δ3=y3(1−y3)(w1,3×δ5)
=0.56(1−0.56)(0.3×−0.0376)=−0.0027=0.56(1−0.56)
(0.3×−0.0376)=−0.0027
For h2:
δ4=y4(1−y4)(w2,3×δ5)δ4=y4(1−y4)(w2,3×δ5)
=0.59(1−0.59)(0.9×−0.0376)=−0.0819=0.59(1−0.59)
(0.9×−0.0376)=−0.0819
4. Weight Updates
For the weights from hidden to output layer:
Δw2,3=1×(−0.0376)×0.59=−0.022184Δw2,3
=1×(−0.0376)×0.59=−0.022184
New weight:
w2,3(new)
w1,1(new)=0.000945+0.2=0.200945
Similarly other weights are updated:
 w1,2(new)=0.273225w1,2(new)=0.273225
 w1,3(new)=0.086615w1,3(new)=0.086615
 w2,1(new)=0.269445w2,1(new)=0.269445
 w2,2(new)=0.18534w2,2(new)=0.18534
The updated weights are illustrated below

After updating the weights the forward pass is repeated yielding:


 y3=0.57y3=0.57
 y4=0.56y4=0.56
 y5=0.61y5=0.61
Since y5=0.61y5=0.61 is still not the target output the process of calculating the error and
backpropagating continues until the desired output is reached.
This process demonstrates how Back Propagation iteratively updates weights by
minimizing errors until the network accurately predicts the output.
Error=ytarget−y5Error=ytarget−y5
=0.5−0.61=−0.11=0.5−0.61=−0.11
This process is said to be continued until the actual output is gained by the neural network.

Common questions

Powered by AI

The process of backpropagation demonstrates iterative learning by gradually adjusting the network's weights over multiple epochs to minimize error. Each iteration involves a forward pass to calculate the output, followed by a backward pass to compute and apply the necessary weight updates based on the computed errors. This cycle repeats, continuously refining the network's weights based on feedback from the loss function, illustrating an iterative process of trial and error to improve network accuracy progressively .

The learning rate in backpropagation is a critical hyperparameter that determines the step size at each iteration while moving towards a minimum of the loss function. A high learning rate might lead to overshooting the minimum, causing the algorithm to diverge, whereas a low learning rate might result in a slow convergence or getting stuck in local minima. Thus, selecting an appropriate learning rate is crucial for balancing convergence speed and ensuring stable learning of the network parameters .

Backpropagation enables scalability in neural networks by efficiently computing the gradients of the loss function with respect to all weights using the chain rule from calculus, making it computationally feasible to train deep networks with multiple layers. This scalable computation allows for complex architectures with numerous parameters, enabling the implementation of deep learning models that can handle large datasets and sophisticated tasks .

In backpropagation, the weights are updated using the gradients of the loss function with respect to each weight. The gradient indicates the direction and magnitude by which the weights need to be adjusted to minimize error. The change in each weight is computed as Δwij = η × δj × Oj, where η is the learning rate, δj is the error term, and Oj is the output from the respective unit. After computing the gradients, weights are adjusted in small increments based on the learning rate to reduce the error iteratively until the output converges closely to the desired target .

The forward pass is significant as it computes the output of the network for given inputs by passing data through the layers, applying weights, biases, and activation functions. It sets the stage for the backward pass by determining the initial error, which is the difference between expected and actual outputs. This initial error is crucial as backpropagation relies on it to calculate gradients, which are essential for updating weights. Without the forward pass, there would be no baseline error against which improvements are made .

The sigmoid function is commonly used in backpropagation because it introduces non-linearity into the model, enabling the network to learn complex patterns. Additionally, it outputs values between 0 and 1, which can be interpreted as probabilities and aid in binary classification. However, its derivative is also particularly advantageous during backpropagation as it helps in reducing the gradient efficiently, allowing effective learning without exploding gradients .

The backpropagation algorithm efficiently minimizes error by iteratively adjusting the weights and biases of the network to reduce the difference between predicted and actual outputs. It does this by computing the gradient of the loss function with respect to each weight, using the chain rule from calculus, which allows it to efficiently update the weights. This ability to compute gradients accurately and efficiently makes it scalable to networks with many layers and enables deep learning .

The chain rule plays a crucial role in backpropagation by providing a method to compute the derivative of the loss function with respect to each weight in the network. It allows the algorithm to efficiently handle the nested structure of neurons across multiple layers by decomposing the gradients into products of simpler derivatives. This process ensures that the gradients can be computed accurately and that weights can be updated systematically, enabling effective learning .

The backpropagation algorithm involves two main steps: the Forward Pass and the Backward Pass. During the Forward Pass, input data is fed through the network, and outputs are generated by passing the weighted inputs through activation functions. In the Backward Pass, the error is calculated as the difference between the predicted and actual outputs, and this error is propagated backwards through the network to update the weights and biases, using gradients computed via the chain rule. The goal is to minimize the error for subsequent passes .

Errors are propagated back through the network by computing the gradient of the loss function concerning each weight. With the sigmoid function, the output error δ is calculated as δ = y(1-y)(target - y) for the output unit, where y is the output from the neuron. For hidden units, the error δ is propagated using δ = y(1-y)(weighted sum of δ from output layer), with y being the output of the hidden neuron. This process enables each weight to be adjusted by its gradient, steering the network towards reducing its prediction error in the next iteration .

You might also like