PyTorch Tutorial 04 - Backpropagation - Theory With Example

  Рет қаралды 104,146

Patrick Loeber

Patrick Loeber

Күн бұрын

New Tutorial series about Deep Learning with PyTorch!
⭐ Check out Tabnine, the FREE AI-powered code completion tool I use to help me code faster: www.tabnine.com/?... *
In this part I will explain the famous backpropagation algorithm. I will explain all the necessary concepts and walk you through a concrete example. At the end we will see how easy it is to
use backpropagation in PyTorch.
- Chain Rule
- Computational Graph and local gradients
- Forward and backward pass
- Concrete example with numbers (Linear Regression)
- How to use backpropagation in PyTorch
📚 Get my FREE NumPy Handbook:
www.python-engineer.com/numpy...
📓 Notebooks available on Patreon:
/ patrickloeber
⭐ Join Our Discord : / discord
Part 04: Backpropagation - Theory With Example
If you enjoyed this video, please subscribe to the channel!
Official website:
pytorch.org/
Part 01:
• PyTorch Tutorial 01 - ...
Linear Regression from scratch:
• Linear Regression in P...
Code for this tutorial series:
github.com/patrickloeber/pyto...
You can find me here:
Website: www.python-engineer.com
Twitter: / patloeber
GitHub: github.com/patrickloeber
#Python #DeepLearning #Pytorch
----------------------------------------------------------------------------------------------------------
* This is a sponsored link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! 🙏

Пікірлер: 112
@fuma9532
@fuma9532 3 жыл бұрын
Clear, simple, with an easy example... Just brilliant! Thank you so much, I wish more people made things simple :D I'm sharing this!
@patloeber
@patloeber 3 жыл бұрын
thanks so much!
@fuma9532
@fuma9532 3 жыл бұрын
@@patloeber Thank you man: you're doing a great job!
@nicholastaylor9743
@nicholastaylor9743 2 жыл бұрын
This is wonderful. I appreciate the simple example and translating to PyTorch. Too few videos connect the two. Thank you!
@vaibhavtiwari1084
@vaibhavtiwari1084 4 ай бұрын
This is the best video I've seen for backprop, forward pass and how the values get updated. Classic!!
@tanmaybhagwat3650
@tanmaybhagwat3650 3 жыл бұрын
7:30 That's the craziest 1 I have ever seen.
@kaveen_93
@kaveen_93 2 жыл бұрын
That's how we write 1 in Germany, assuming the tutor is from Germany. I believe this is done to ensure the clear difference visually between, 1 (one), I (uppercase i), l (lowercase l) etc,.
@Adarsh256
@Adarsh256 3 жыл бұрын
you're a genius, I've been stuck on this step since ages. Thanks and keep going!!
@patloeber
@patloeber 3 жыл бұрын
Glad you like it!
@jayceonsantana1405
@jayceonsantana1405 2 жыл бұрын
i guess it's kind of off topic but does anybody know a good website to stream new tv shows online ?
@leonidaspreston3310
@leonidaspreston3310 2 жыл бұрын
@Jayceon Santana Flixportal :D
@jayceonsantana1405
@jayceonsantana1405 2 жыл бұрын
@Leonidas Preston Thanks, I signed up and it seems like a nice service :) Appreciate it !
@leonidaspreston3310
@leonidaspreston3310 2 жыл бұрын
@Jayceon Santana No problem xD
@amitg2k
@amitg2k 2 жыл бұрын
You just made it look so simple. One of the best tutorials in a long time. Many thanks.
@patloeber
@patloeber 2 жыл бұрын
Glad you liked it!
@sugamtyagi9144
@sugamtyagi9144 3 жыл бұрын
I found your explaination of backpropogation very intutitive. I'm loving this playlist.
@patloeber
@patloeber 3 жыл бұрын
Thank you 😊
@djchrisi
@djchrisi 2 жыл бұрын
Da hast du mich wirklich an die Hand genommen und alles ganz super erklärt! danke schön!
@Vikram-wx4hg
@Vikram-wx4hg 3 жыл бұрын
Excellent clarity and explanation!
@ericohana9650
@ericohana9650 2 жыл бұрын
Short, sweet and to the point, thank you!
@hpaghababa8111
@hpaghababa8111 3 жыл бұрын
That was a great tutorial and I enjoyed it. Before watching this video I used to calculate gradients through a painful operations!!! It would be interesting if you could have other examples with a bit complicated functions like multi-rule functions (say absolute value function for example). Moreover, if you give an exercise to do and attach a solution, it would be great for learners to practice, I guess.
@davidcordova1773
@davidcordova1773 2 жыл бұрын
this is the best explanation of backpropagation on youtube, thank u so much
@patloeber
@patloeber 2 жыл бұрын
Glad to hear thar!
@johnhildenbrand9867
@johnhildenbrand9867 Жыл бұрын
First time I finally understand the chain rule in detail....thx!
@hamzawi2752
@hamzawi2752 7 ай бұрын
Thank you so much for your extraordinary explanation. Please keep up this informative video.
@josepoktopus8924
@josepoktopus8924 3 ай бұрын
Simple and precise, go ahead with your great work.
@choco4429
@choco4429 3 жыл бұрын
Your video is clearer than my teacher's lecture. I subscribe directly
@patloeber
@patloeber 3 жыл бұрын
thanks! glad yo hear that
@arslanali900
@arslanali900 6 ай бұрын
Amazing explanation! good job man.
@imdadood5705
@imdadood5705 2 жыл бұрын
I have always noticed. Even the complicated topics can be easily explained when we simple numbers without going with the alphabets. Thanks, Python Engineer!
@patloeber
@patloeber 2 жыл бұрын
glad to hear that :)
@kevinliao9938
@kevinliao9938 28 күн бұрын
This is really helpful. Thank you!
@castilTube
@castilTube 3 жыл бұрын
Great explanation!. Thank you very much for this video. Your channel is fantastic!
@patloeber
@patloeber 3 жыл бұрын
thanks for the feedback :)
@dfdiasbr
@dfdiasbr 2 ай бұрын
😱 what an explanation! Thanks!!
@xinyi9015
@xinyi9015 3 жыл бұрын
It's really helpful! Thank you!
@Kimthepowerfuljong-un
@Kimthepowerfuljong-un 10 ай бұрын
the best video i could've ever find! thanksss!
@HieuTran-rt1mv
@HieuTran-rt1mv 3 жыл бұрын
Great! So easy to understand. Thank you so much
@patloeber
@patloeber 3 жыл бұрын
Glad you like it!
@greenmanhulk
@greenmanhulk Жыл бұрын
The best so far
@Andrey-dh6sx
@Andrey-dh6sx 3 жыл бұрын
Thanks, very detailed explanation, helped a lot!
@patloeber
@patloeber 3 жыл бұрын
Great to hear!
@justlasse7773
@justlasse7773 6 ай бұрын
Thank you so much!
@dwhdai
@dwhdai 3 жыл бұрын
great videos, thanks for doing these!
@patloeber
@patloeber 3 жыл бұрын
glad you like it!
@maithilijoshi796
@maithilijoshi796 Жыл бұрын
thankyou for the explanation
@alirezamohseni5045
@alirezamohseni5045 3 ай бұрын
that was very useful, thank you so mush
@jacobmoore8734
@jacobmoore8734 3 ай бұрын
One quick note about linear regression @4:46, gradient methods are almost never used in practice because there is a closed form solution with pure linear algebra.
@albertog2196
@albertog2196 3 жыл бұрын
Thanks. Good explanation
@patloeber
@patloeber 3 жыл бұрын
Thanks :)
@sb-tq3xw
@sb-tq3xw 3 жыл бұрын
thanks a lot for this video, keep going!!!
@patloeber
@patloeber 3 жыл бұрын
Glad you like it :)
@adeelahmad1066
@adeelahmad1066 4 ай бұрын
Thanks, I like this tutorial
@alirezaasadi9109
@alirezaasadi9109 3 жыл бұрын
Keep on going ... Very very useful ...
@patloeber
@patloeber 3 жыл бұрын
thanks :)
@adityasahu96
@adityasahu96 3 жыл бұрын
extremely well explained.
@patloeber
@patloeber 3 жыл бұрын
Thanks 😊
@yangthomas5064
@yangthomas5064 4 ай бұрын
love it ,good
@vipulritwik
@vipulritwik 4 жыл бұрын
Very well taught
@patloeber
@patloeber 4 жыл бұрын
thanks!
@shrawansahu9500
@shrawansahu9500 2 жыл бұрын
It was Brilliant can you please add playlist for Pytorch with NLP
@InfoArduino
@InfoArduino 3 жыл бұрын
Very good!
@patloeber
@patloeber 3 жыл бұрын
thanks!
@ashishpondit8183
@ashishpondit8183 3 жыл бұрын
thanks man big help
@patloeber
@patloeber 3 жыл бұрын
Glad it is helpful!
@monsterpets5899
@monsterpets5899 6 ай бұрын
love it
@muntasiradnan6321
@muntasiradnan6321 2 ай бұрын
so after backward pass 1st iteration, first we need to reset gradient, right? then start a new iteration like update weight, forward pass and so on?
@jorgemercadog
@jorgemercadog 3 жыл бұрын
Thank you!!
@patloeber
@patloeber 3 жыл бұрын
glad you like it!
@manideepgupta2433
@manideepgupta2433 4 жыл бұрын
hey!! your videos are very clear! but i have a small question in this, if x,y are 2 separate variables, then dz/dx=x'y+yx' ? why did you consider other variable as a constant? at 2:55
@patloeber
@patloeber 4 жыл бұрын
Thanks for watching! In this toy example the function is x*y, so df/dx=y. We are using partial derivatives here, that means the other one is constant. But we also have to do the partial derivative for y then
@nikcru
@nikcru 4 жыл бұрын
i request you to make a Udemy course out of these video series, very nicely taught.
@patloeber
@patloeber 3 жыл бұрын
thanks! maybe in the future! What kind of course would you be interested in?
@thomasgeudens7131
@thomasgeudens7131 3 жыл бұрын
@@patloeber machine learning from zero to hero?
@lambsauce5445
@lambsauce5445 3 жыл бұрын
@@patloeber a full course. Please. It'd go really well. Please make it free tho...
@robosergTV
@robosergTV 2 жыл бұрын
@@lambsauce5445 a free course is the one you watch LOL
@TheOraware
@TheOraware 3 жыл бұрын
Hi Patrick , you are great thanks for it. At 6:35 doing backward pass you mentioned dloss/dy^ , i think it should be ds/dy^ isnt? Please clear my confusion
@patloeber
@patloeber 3 жыл бұрын
No what I mentioned is correct. Maybe it gets clearer at minute 9 when I explain the steps in more detail. While doing the backward pass we need dloss/dy^ as an intermediate result for the chain rule
@Kenbomp
@Kenbomp 2 жыл бұрын
Nice to have a use for calculus
@patloeber
@patloeber 2 жыл бұрын
Indeed!
@whaysdsdsd973
@whaysdsdsd973 2 жыл бұрын
Thank you so much (T^T), it made me understand.
@mykun8737
@mykun8737 2 жыл бұрын
thanks, How simple everything is when I hear you draw pictures with a pen and explain
@rohit2761
@rohit2761 2 жыл бұрын
I have installed torch in my system. But in VS code, it shows "No module named torch". If i create virtual env and then pip install torch, it works. But Not In VS Code. Please help Thanks
@panosparaskevopoulos5043
@panosparaskevopoulos5043 4 ай бұрын
im 13 yo and i can confirm that some experiments with pytorch, help of chat gpt and a lot of thinking i manage to follow along (to be noted: i havent even been introduced to calculus or anything similar and im not a native speaker as you can see)
@ezdul2404
@ezdul2404 8 ай бұрын
Great video, nice coding examples, but at 7:57 ds/dy^ should be -1 and not 1
@rodrigosalazar6112
@rodrigosalazar6112 7 ай бұрын
It's 1. In this case it is taking the derivative with respect to y^, not y. This means y is treated as a constant here with regards to the derivative. The y gets dropped and the y^ turns into just it's coefficient which is 1.
@ahmetcihan8025
@ahmetcihan8025 3 жыл бұрын
Hi Patrick my friend could you do c++ opencv tutorials also ? Thanks.
@patloeber
@patloeber 3 жыл бұрын
Good suggestion! Maybe in the future :)
@sandroalexormeno
@sandroalexormeno 3 жыл бұрын
This is a very useful tutorial. But i need a little bit explanation. when you said (4:47) dLoss/ds =ds^s/ds = 2s, but it,s not simple for me, why it's equal to 2s ??? Please give me a way or a route to understand it.
@sandroalexormeno
@sandroalexormeno 3 жыл бұрын
OH, I found my own answer
@patloeber
@patloeber 3 жыл бұрын
Glad you like it!
@pokemonXD1
@pokemonXD1 3 жыл бұрын
Could either of you explain this to me please? I don't understand how we'd get 2s.
@pokemonXD1
@pokemonXD1 3 жыл бұрын
Oh wait. dloss/ds where loss = s^2 so it's dloss = s^2 ds => dloss = 2s.
@steven9492
@steven9492 Жыл бұрын
great video! the only thing complicated is this guys "1".
@user-lx6lq7xb7c
@user-lx6lq7xb7c Жыл бұрын
8:10 I need learn some calculate. to figure out why the answer is 1.
@JohnFerrier
@JohnFerrier 3 жыл бұрын
Why is your 1 an upside down v? It makes things difficult to follow sometimes
@gastroacid1971
@gastroacid1971 Жыл бұрын
Strange it makes you disable gradients with no_grad() in order to actually subtract them. The software doing the calculus for you makes it much easier than writing the code manually in C++.
@lucyfrye6723
@lucyfrye6723 Жыл бұрын
I did just that. It helps if you use a good linear algebra library, without it I got completely lost in endless for loops and keeping track of indices. By using the Eigen library , as if by magic, all the equations reduced to about 8 lines of code, it was one of the most gratifying pet projects I ever did, seeing four screens of unreadable code get reduced to a golden nugget. It took me about 8 days, including doing it the wrong way and learning the new library. I can recommend it!
@minipy3164
@minipy3164 3 жыл бұрын
This is the best explanation for backpropagation in the entire KZbin
@patloeber
@patloeber 3 жыл бұрын
thanks so much!
@AKSHAY99552
@AKSHAY99552 Жыл бұрын
why the calculation of d (y_pred - y)/d y_pred = 1 why not -1 ?
@muhammadbilalhaneefqureshi48
@muhammadbilalhaneefqureshi48 5 ай бұрын
due to square, (-1)^2 = 1
@sanjaykrish8719
@sanjaykrish8719 3 жыл бұрын
PyTorch should have this as their official tutorial..
@patloeber
@patloeber 3 жыл бұрын
thanks!
@vatsal_gamit
@vatsal_gamit 3 жыл бұрын
Can anyone please tell me how to remove that extra path in output terminal in VS code?? How to get clean output
@patloeber
@patloeber 3 жыл бұрын
Can be found in the settings for the code runner extension
@shaheryarshafi
@shaheryarshafi 4 жыл бұрын
i didn't understand backward pass clearly how we got -2
@akashverma4280
@akashverma4280 3 жыл бұрын
it is based on the chain rule. Can you explain exactly what you didn't understand? I will try to help.
@user-lx6lq7xb7c
@user-lx6lq7xb7c Жыл бұрын
9:53 final gradient = -2 dLoss/dw = -2 12:36 w.grad mean dLoss/d w h.grad dLoss/d h g.grad dLoss/d g
@gorkemvids4839
@gorkemvids4839 2 жыл бұрын
It could be better with proper naming
@my_opiniondemocracy6584
@my_opiniondemocracy6584 Жыл бұрын
your one dosent seem to be a one...it seems like a big lamda... please try to correct it
What is Back Propagation
8:00
IBM Technology
Рет қаралды 44 М.
Joven bailarín noquea a ladrón de un golpe #nmas #shorts
00:17
FOUND MONEY 😱 #shorts
00:31
dednahype
Рет қаралды 10 МЛН
Follow @karina-kola please 🙏🥺
00:21
Andrey Grechka
Рет қаралды 24 МЛН
КАКОЙ ВАШ ЛЮБИМЫЙ ЦВЕТ?😍 #game #shorts
00:17
Tutorial 6-Chain Rule of Differentiation with BackPropagation
13:43
PyTorch Tutorial 07 - Linear Regression
12:11
Patrick Loeber
Рет қаралды 78 М.
Building a Neural Network with PyTorch in 15 Minutes | Coding Challenge
20:34
Backpropagation explained | Part 1 - The intuition
10:56
deeplizard
Рет қаралды 113 М.
Understanding Backpropagation In Neural Networks with Basic Calculus
24:28
PYTORCH COMMON MISTAKES - How To Save Time 🕒
19:12
Aladdin Persson
Рет қаралды 53 М.
Top 10 Python One Liners YOU MUST KNOW!
4:52
Patrick Loeber
Рет қаралды 136 М.
PyTorch Tutorial 08 - Logistic Regression
18:22
Patrick Loeber
Рет қаралды 63 М.
Joven bailarín noquea a ladrón de un golpe #nmas #shorts
00:17