Backpropagation For Neural Networks Explained | Deep Learning Tutorial
Key Takeaways
The video explains the Backpropagation algorithm for neural networks, a crucial concept in deep learning, and walks through a concrete example with numbers to illustrate the theory behind the algorithm. It covers the basics of backpropagation, computational graphs, and the chain rule, and demonstrates how to apply these concepts to a simple linear regression algorithm.
Full Transcript
hi everyone in this video we learn about the back propagation algorithm back propagation is probably the most important concept in deep learning and is essential for the training process of a neural network so today we have a look at what backpropagation is and how it works and then i also walk you through a concrete example with some numbers because i think this will help you to better understand the theory behind the algorithm this video is part of the deep learning explain series by assembly ai which is a company that creates a state-of-the-art speech to text api and if you want to try assembly ai for free you can grab your free api token using the link in the description and now let's get started backpropagation computes the gradients of a loss function with respect to the weights in a neural network this gradient is then used to update the weights in the training step for example with an optimization algorithm like gradient descent now a quick side note i'm going to use the term gradient in this video all the time and with gradient i also mean derivative so here we have a neural network with an input layer a hidden layer and an output layer and at each neuron we have different weights and then we multiply the weights with the input x and maybe add a bias and now the way it works is that we first do a forward pass where we apply all those neurons and then calculate the loss at the very end and then we apply the back propagation algorithm which means we apply a backward pass and can then calculate the gradients with a special method and then with this gradient we can update the weights which means our neural network learns and gets better so we will have a closer look at the backward pass but before we do this we have to understand two more concepts the first concept is the concept of a computational graph when we create our network with all the neurons each computation in it is represented by a node so for example here we have a multiplication node that simply multiplies the two inputs x and w with each other and then of course we also have many more computations in this graph and at the very end we calculate the loss and like i said we then want to calculate the gradient of the loss with respect to the weights so the concept of the computational graph is the first thing we should keep in mind this is also what deep learning frameworks like pytorch and tensorflow use internally to track all the computations in the network and the second concept we should know is the chain rule this is a mathematical formula that is needed to calculate the gradients so here we have a simple computational graph with an input a that gets transformed by the first node and then we get the output b and this in turn gets transformed by the second node and we get the output c now the chain rule says that the gradient of c with respect to a can be computed by the gradient of c with respect to b times the gradient of b with respect to a so we should remember this formula and don't worry it's not that difficult when we look at a concrete example in a moment so going back to our computational graph we can now calculate the gradient of the loss with respect to the weights by saying it's the gradient of the loss with respect to y times the gradient of y with respect to w both of those inner gradients are also called local gradients and they can be calculated pretty easy for example if we have a look at this node here we know this is a multiplication node so we know the function or the calculations here y gets calculated by applying the function w times x and the derivative of w times x with respect to w is simply x so we can do this for all the nodes in our network which just are simple computational nodes and then we can also easily calculate the local gradients so we have to start at the very last node and then step by step go backwards to the first node and this is the whole concept of the backpropagation algorithm first we do a forward pass and do all calculations and calculate the loss then we compute all local gradients and then we do a backward pass and apply the chain rule so with this we calculate the gradient of the loss with respect to the weights and then of course we can update the weight somehow with this information and that's it so now let's take a look at a concrete example to better understand all steps in this example we look at a simple linear regression algorithm we can also represent this with a neural network and a computational graph first we have a multiplication node that multiplies the weights and the input and we get an approximated y that we call y hat then we also have the actual y so we use a second subtraction node and we calculate y hat minus y and then we calculate the loss function which usually is the root mean squared error and to keep it simpler we only use the squared arrow here so we have one more note with a square operation and then obtain the loss now the task is to minimize the loss for example with the gradient descent method so for this we have to calculate the gradient of the loss with respect to the weights and we just learned we have to apply three steps first we do the forward pass and calculate the loss then at each node we calculate the local gradients starting at the end so we have d loss with respect to s then d s with respect to y hat and d y hat with respect to w and then we do the backward pass and can calculate the loss with respect to y hat and finally d loss with respect to w so this is what we need and we get this by applying the chain rule so let's use some actual numbers here so for example we know the input x and the corresponding y from the training data and we simply initialize the first weight with one so y-hat is the multiplication one times one which is one then we do the subtraction one minus two which is minus one and then we do the square operation so the loss is minus one squared which is one now let's calculate the local gradients d loss with respect to s we know the function so this is s squared and the gradient of s squared with respect to s is 2s next we calculate the gradient of s with respect to y hat so again we apply the actual calculations this is the gradient of y hat minus y with respect to y hat which is simply 1 and then we calculate the gradient of y hat with respect to w and y hat can be written as w times x and the gradient of this is x so now let's do the backward pass we calculate the gradient of the loss with respect to y hat by applying the chain rule so these two gradients are the two local gradients we just computed so this is two times s times one and we also know that s is minus one from our forward pass calculations so this is then -2 so the very last step is to calculate the gradient of the loss with respect to w again we apply the chain rule so here we have the gradient from the previous step the loss with respect to y hat times the local gradient d y hat with respect to w and then we insert the actual numbers minus two times x so this is minus two and then we reach the end and can update our weights and that's basically it so if you couldn't follow every step right now this is fine you can get the slides using the link in the description and then you can go through it again in your own pace but i hope i could explain the concept of back propagation in a fairly simple way if you still have any questions then let me know in the comments and also if you enjoyed the video then please hit the like button and consider subscribing to our channel for more content like this and then i hope to see you in the next video bye
Original Description
In this Deep Learning tutorial, we learn about the Backpropagation algorithm for neural networks.
Get your Free Token for AssemblyAI Speech-To-Text API 👇
https://www.assemblyai.com/?utm_source=youtube&utm_medium=referral&utm_campaign=yt_pat_5
Backpropagation is probably the most important concept in deep learning and is essential for the training process of a neural network.
Today we have a look at what Backpropagation is and how it works. We then walk you through an example with concrete numbers to better understand the theory behind the algorithm.
Slides: https://github.com/AssemblyAI/youtube-tutorials
Timestamps:
00:00 Introduction
00:39 Definition
01:44 Computational Graph
02:24 Chain Rule
03:03 Backpropagation algorithm
04:18 Example calculation
07:29 Outro
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from AssemblyAI · AssemblyAI · 34 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
▶
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Python Speech Recognition in 5 Minutes
AssemblyAI
Python Click Part 1 of 4
AssemblyAI
Python Click Part 2 of 4
AssemblyAI
Python Click Part 3 of 4
AssemblyAI
Python Click Part 4 of 4
AssemblyAI
Deep learning in 5 minutes | What is deep learning?
AssemblyAI
How to make a web app that transcribes YouTube videos with Streamlit | Part 1
AssemblyAI
How to make a web app that transcribes YouTube videos with Streamlit | Part 2
AssemblyAI
Batch normalization | What it is and how to implement it
AssemblyAI
Real-time Speech Recognition in 15 minutes with AssemblyAI
AssemblyAI
Regularization in a Neural Network | Dealing with overfitting
AssemblyAI
Add speech recognition to your Streamlit apps in 5 minutes
AssemblyAI
Transformers for beginners | What are they and how do they work
AssemblyAI
Automatic Chapter Detection With AssemblyAI | Python Tutorial
AssemblyAI
Deep Learning Series Part 1 - What is Deep Learning?
AssemblyAI
Deep Learning Series part 2 - Why is it called “Deep Learning”?
AssemblyAI
Activation Functions In Neural Networks Explained | Deep Learning Tutorial
AssemblyAI
Deep Learning Series part 3 - Deep Learning vs. Machine Learning
AssemblyAI
Deep Learning Series part 4 - Why is Deep Learning better for NLP?
AssemblyAI
Intro to Batch Normalization Part 1
AssemblyAI
Intro to Batch Normalization Part 2
AssemblyAI
Intro to Batch Normalization Part 3 - What is Normalization?
AssemblyAI
Intro to Batch Normalization Part 4
AssemblyAI
Intro to Batch Normalization Part 5
AssemblyAI
Sentiment Analysis for Earnings Calls with AssemblyAI
AssemblyAI
Summarizing my favorite podcasts with Python
AssemblyAI
Introduction to Regularization
AssemblyAI
How/Why Regularization in Neural Networks?
AssemblyAI
Getting Started With Torchaudio | PyTorch Tutorial
AssemblyAI
Types of Regularization
AssemblyAI
Tuning Alpha in L1 and L2 Regularization
AssemblyAI
Dropout Regularization
AssemblyAI
What is GPT-3 and how does it work? | A Quick Review
AssemblyAI
Backpropagation For Neural Networks Explained | Deep Learning Tutorial
AssemblyAI
Jupyter Notebooks Tutorial | How to use them & tips and tricks!
AssemblyAI
Best Free Speech-To-Text APIs and Open Source Libraries
AssemblyAI
Regularization - Early stopping
AssemblyAI
Regularization - Data Augmentation
AssemblyAI
Bias and Variance for Machine Learning | Deep Learning
AssemblyAI
Recurrent Neural Networks (RNNs) Explained - Deep Learning
AssemblyAI
What is BERT and how does it work? | A Quick Review
AssemblyAI
Introduction to Transformers
AssemblyAI
Transformers | What is attention?
AssemblyAI
Transformers | how attention relates to Transformers
AssemblyAI
Transformers | Basics of Transformers
AssemblyAI
Supervised Machine Learning Explained For Beginners
AssemblyAI
Transformers | Basics of Transformers Encoders
AssemblyAI
Transformers | Basics of Transformers I/O
AssemblyAI
How to evaluate ML models | Evaluation metrics for machine learning
AssemblyAI
Unsupervised Machine Learning Explained For Beginners
AssemblyAI
Weight Initialization for Deep Feedforward Neural Networks
AssemblyAI
Q-Learning Explained - Reinforcement Learning Tutorial
AssemblyAI
Should You Use PyTorch or TensorFlow in 2022?
AssemblyAI
What is Layer Normalization? | Deep Learning Fundamentals
AssemblyAI
I created a Python App to study FASTER
AssemblyAI
How to create your FIRST NEURAL NETWORK with TensorFlow!
AssemblyAI
Neural Networks Summary: All hyperparameters
AssemblyAI
Getting Started with OpenAI API and GPT-3 | Beginner Python Tutorial
AssemblyAI
Convert Speech-To-Text In Python in 60 seconds!
AssemblyAI
Gradient Clipping for Neural Networks | Deep Learning Fundamentals
AssemblyAI
More on: ML Maths Basics
View skill →Related Reads
📰
📰
📰
📰
When Should AI Teams Replace a Model in Production?
Dev.to · Ye Allen
Stop Writing Python Classes Until You Learn The 4 Things You Can Do To Every Piece Of Data An…
Medium · Programming
Top 10 AI Evaluation Interview Questions and Answers
Medium · Machine Learning
We took highlight detection from 0.56 to 0.86 — with zero new footage and zero cloud training
Dev.to AI
Chapters (7)
Introduction
0:39
Definition
1:44
Computational Graph
2:24
Chain Rule
3:03
Backpropagation algorithm
4:18
Example calculation
7:29
Outro
🎓
Tutor Explanation
DeepCamp AI