3.4: Linear Regression with Gradient Descent - Intelligence and Learning

In this video I continue my Machine Learning series and attempt to explain Linear Regression with Gradient Descent.
My Video explaining the Mathematics of Gradient Descent: • 3.5: Mathematics of Gr...
This video is part of session 3 of my Spring 2017 ITP "Intelligence and Learning" course (github.com/shiffman/NOC-S17-2...)
Support this channel on Patreon: / codingtrain
To buy Coding Train merchandise: www.designbyhumans.com/shop/c...
Send me your questions and coding challenges!: github.com/CodingTrain/Rainbo...
Contact:
Twitter: / shiffman
The Coding Train website: thecodingtrain.com/
Links discussed in this video:
Session 3 of Intelligence and Learning: github.com/shiffman/NOC-S17-2...
Nature of Code: natureofcode.com/
kwichmann's Linear Regression Diagnostics: kwichmann.github.io/ml_sandbo...
Linear Regression on Wikipedia: en.wikipedia.org/wiki/Linear_...
Source Code for the all Video Lessons: github.com/CodingTrain/Rainbo...
p5.js: p5js.org/
Processing: processing.org
For More Coding Challenges: • Coding Challenges
For More Intelligence and Learning: • Intelligence and Learning
Help us caption & translate this video!
amara.org/v/7Yh8/
📄 Code of Conduct: github.com/CodingTrain/Code-o...

Пікірлер: 172

  • @FANSasFRIENDS
    @FANSasFRIENDS Жыл бұрын

    This is the amount of enthusiasm I need from my professor. Keep up the good work, sir!

  • @josephgigot8827
    @josephgigot88276 жыл бұрын

    You are a really great teacher. Watching you, we are feeling that you re-discover what you already knows with us ! I think it is the perfect way to learn people knowledges !

  • @luisa534
    @luisa5342 жыл бұрын

    got stuck on gradient descent from the andrew ng coursera course, so as always, I'm back here for more digestable explanations. love your teaching style!

  • @LearnWithYK
    @LearnWithYK3 жыл бұрын

    Excellent. Love the way you present - enthusiastic, excited, but totally at ease.

  • @sagauer
    @sagauer7 жыл бұрын

    Hey, I am watching your channel for the first time and I am amazed how good you explain things! I am a teacher myself and I find you very inspiring!

  • @NickKartha
    @NickKartha6 жыл бұрын

    2:35 spoiler for Avengers: Infinity War

  • @franciscohanna2956
    @franciscohanna29567 жыл бұрын

    Great videos Daniel! Thank you! I started a IA course at college this semester (it's almost ending now), and this helped me to settle what I was studying. Keep it up!

  • @Kevin-ex9vr
    @Kevin-ex9vr Жыл бұрын

    man, this series with both board and coding together is really the best from yt, congrats

  • @Manojshankaraj
    @Manojshankaraj5 жыл бұрын

    Really awesome video! Thank you for making machine learning and math so much fun!!

  • @niharika7631
    @niharika76316 жыл бұрын

    Dan i love how you get so excited to explain things.. So much to say! 😅 super cute. Plus so informative. I m glad I found this channel.

  • @MrGlitch888
    @MrGlitch8883 жыл бұрын

    Keep up the good work. Your teaching is the best, especially when it comes to complicated topics.

  • @anubratanath5342
    @anubratanath53423 жыл бұрын

    This is the most intuitive explanation of linear regression. Thank you sir!

  • @niklasheise
    @niklasheise6 жыл бұрын

    Its incredible when you display the error and guess values, my next try is to make a learning rate which changes depending on the numbers behind the comma. This tutorial is awesome!!

  • @mkalicharan
    @mkalicharan6 жыл бұрын

    How awesome is this explanation, theory + programming is the way to go Coding train

  • @sarangchouguley6292
    @sarangchouguley62925 жыл бұрын

    Thank you Dan. Really you made this topic so easy to understand. Keep up the good work.

  • @juliekell9454
    @juliekell94546 жыл бұрын

    Thank you for this. I was taking a coursera course on machine learning and got stuck on week one (incredibly frustrating!!) because half the math instructions didnt make sense. I had no idea it was so simple! I just passed week one. Thank you.

  • @kwajomensah940
    @kwajomensah9407 жыл бұрын

    Thank you so much! I've been wanting to go over statistics to start diving into ml and mv you've just made my day!

  • @TheCodingTrain

    @TheCodingTrain

    7 жыл бұрын

    I'm so glad to hear, thank you!

  • @kingoros
    @kingoros7 жыл бұрын

    Thank you for making these! Very informative!

  • @TheCodingTrain

    @TheCodingTrain

    7 жыл бұрын

    You're welcome!

  • @st101k

    @st101k

    7 жыл бұрын

    I agree ;)

  • @sues4370
    @sues4370 Жыл бұрын

    This was a great visual representation of SGD, thank you!

  • @christophersheppard3249
    @christophersheppard3249 Жыл бұрын

    You single handedly made me go into cs. Thank you for your inspiration.

  • @SharonKlinkenberg
    @SharonKlinkenberg7 жыл бұрын

    Great videos Dan keep up the good work. The code really helps getting a handle on the theory.

  • @TheCodingTrain

    @TheCodingTrain

    7 жыл бұрын

    That's great to hear.

  • @teja2775
    @teja27755 жыл бұрын

    Awesome cool..... What a teaching style I really love it you made my day by understanding linear regression with simple story really love you man

  • @syedabuthahirkaz
    @syedabuthahirkaz6 жыл бұрын

    Shiffman is always nice man. Love you Guru !

  • @zhimingkoh1029
    @zhimingkoh10293 жыл бұрын

    Hey Dan, thank you so much for making all these videos (: You're amazing!

  • @gracelungu3646
    @gracelungu36467 жыл бұрын

    This channel is really an amazing place to learn high programming algorithm. thank you for the videos Mr shiffman.

  • @TheCodingTrain

    @TheCodingTrain

    7 жыл бұрын

    Thank you!

  • @PatrickPissurno
    @PatrickPissurno6 жыл бұрын

    You're really amazing! Thank you so much. Really enjoyed the way you explain things.

  • @solomonrajkumar5537
    @solomonrajkumar55372 жыл бұрын

    you are really incredibly awesome teaching Sir!!!!... there is no words say....

  • @varalakshmi3932
    @varalakshmi39323 жыл бұрын

    Great videos! You are good at making videos by just being yourself and explaining in the best way possible. :))

  • @aeroptical
    @aeroptical7 жыл бұрын

    Sooo impressed by the white board being magically erased! I watched the live stream and thought it would be a total disaster; well, I'm beyond impressed - some fine editing there! :) Loving the ML series so far Dan.

  • @mohammedsaeed7241
    @mohammedsaeed72412 жыл бұрын

    Dude thank you so much for the intuition! many ppl don't bother going through that

  • @miteshsharma3106
    @miteshsharma31067 жыл бұрын

    the snap was cool ..... but we saw the truth in livestream lol😁

  • @dukestt
    @dukestt7 жыл бұрын

    It worked yay haha. I was waiting for it. I was watching at the time though.

  • @matteoveraldi.musica
    @matteoveraldi.musica6 жыл бұрын

    you're the boss. Very good explanation, loved it!

  • @fernandonakamuta1502
    @fernandonakamuta15026 жыл бұрын

    That is an awesome use of DOM man!

  • @wengeance8962
    @wengeance89627 жыл бұрын

    Dan is wearing a funky t-shirt! looks good!

  • @josephkarianjahi1467
    @josephkarianjahi14672 жыл бұрын

    You are hilarious man! Best teacher on youtube for machine learning

  • @crehenge2386
    @crehenge23867 жыл бұрын

    thank you for showing me how to implement multivariable calculus in programming!

  • @massadian75
    @massadian757 жыл бұрын

    Very interesting !

  • @arzoosingh5388
    @arzoosingh53885 жыл бұрын

    I must say i like the way you teach . You're a nice man God bless .

  • @rajcuthrapali800
    @rajcuthrapali8007 жыл бұрын

    you are like my coding guru lol thanks so much mr dan for your help!

  • @amitbansode
    @amitbansode6 жыл бұрын

    All videos by you are rocking

  • @francescozappala8822
    @francescozappala88227 жыл бұрын

    Hi, I love your videos...I think they are amazing! I'm Italian and don't understand many words😕 you are great!

  • @TheCodingTrain

    @TheCodingTrain

    7 жыл бұрын

    Thank you! I need to get more language subtitles!

  • @ElBellacko1
    @ElBellacko12 жыл бұрын

    great explanation

  • @jadrima8640
    @jadrima86407 жыл бұрын

    Nice tutorial channel!

  • @jairajsahgal5062
    @jairajsahgal50624 жыл бұрын

    you are a good man. thank u

  • @renelalla7799
    @renelalla77996 жыл бұрын

    Thank you for your awesome and easy to understand explanations! :) But I have a question regarding the code from 18:08 Why can we see the line moving instead of being just in its final position? So far, as I can see it in the code, the drawline() method is called after the gradientDescent() method. What am I missing here?

  • @benjaminsmeding8966
    @benjaminsmeding89667 жыл бұрын

    Hi Dan, I really enjoy your movies, I'm a self thought programmer and your movies give a real good insight in different kind of algorithms. Maybe nice to know... I'm actually a railtrack (P-Way) engineer and we use for example the least square method quite a lot. Keep up the great work! Ps. If your interested in some actual train datasets (from the Dutch Rail Network) leave a message.

  • @TheCodingTrain

    @TheCodingTrain

    7 жыл бұрын

    Oh yes, that could be good!

  • @thehappycoder3760
    @thehappycoder37602 жыл бұрын

    Very helpful

  • @capmi1379
    @capmi13797 жыл бұрын

    Wow! machine learning!.. you gave understanding how they work and how they write by line by line without package unlike package like tensor flow XD Wow..thank u

  • @darek4488
    @darek44885 жыл бұрын

    You need separate learning rates for m and b. Then set the learning rate for b higher than the one for m so it would rotate faster, but move up and down slower.

  • @TheNikhilmishras
    @TheNikhilmishras7 жыл бұрын

    Great videos! :D You are the best! Do you recommend going with "Intelligence and Learning" sessions after p5.js introduction for someone who wants to get into Machine learning?

  • @jasdeepsinghgrover2470
    @jasdeepsinghgrover24707 жыл бұрын

    GREAT Video .. Thanks a Lot

  • @jasdeepsinghgrover2470

    @jasdeepsinghgrover2470

    7 жыл бұрын

    had a small doubt, shouldn't the change in slope be error/x instead of error*x?as it is rise / run

  • @Algebrodadio
    @Algebrodadio7 жыл бұрын

    Are you going over gradient descent because it's used by the back propagation algorithms for neural networks? Because I can't wait to watch you do stuff with NN's.

  • @TheCodingTrain

    @TheCodingTrain

    7 жыл бұрын

    That's right!

  • @himannamdari7375
    @himannamdari73756 жыл бұрын

    I love this video Great Tnx Nice logo on your shirt

  • @junaid1464
    @junaid14647 жыл бұрын

    wonderful. nobody can teach better than you.

  • @TheCodingTrain

    @TheCodingTrain

    7 жыл бұрын

    Thank you so much!

  • @vengalraochowdary4712
    @vengalraochowdary47124 жыл бұрын

    Really superb explanation of Gradient Descent. Is there any book which you refer or suggest us for Machine Learning ?

  • @adammontgomery7980
    @adammontgomery79805 жыл бұрын

    Would you have two separate learning rates for m and b? Seems like weighting the slope change higher could be beneficial.

  • @gozumetaklanlar9274
    @gozumetaklanlar92747 жыл бұрын

    Hi Dan, greate video. I had watch most of your videos and I would be glad if you could make video about addEventListener and what advantages and disadvantages over onclick, onblur, onmouseover... thank you in advance

  • @Contradel
    @Contradel7 жыл бұрын

    So my guess on an explanation on these lines: m = m + (error * x) * learning_rate; b = b + (error) * learning_rate; First line: think about the question "when I change m, how does that affect y?". This is what calculus is used for, more specifically differentiation. The answer to the question is written in math as dy/dm, if our line expression is defined as: y = m * x + b. dy/dm = D(m * x + b, m) = x. This is why the error should by multiplied by x. For the second line same thing! Change of y when changing b? dy/db = D(m * x + b, b) = 1. We could multiply error by 1, or leave it out as Shiffman did. What does the D function do? It differentiates the expression with regards to the second parameter passed. To calculate this you can either use a calculator, use a lookup table of rules or derive the answer yourself following the proof.

  • @troatie

    @troatie

    7 жыл бұрын

    This isn't quite right I don't think? Shouldn't you divide by x? Let's say your error was 1. So you want to change y by 1. If you change m by 1 you'll get a change of x! out of that. If you change m by 1/x you'll get the 1 out that you want. Or maybe written out... e1 = y - m1 * x - b1 e2 = y - (m1 + m_change) * x - b1 if you want e2 to be 0, then you get 0 = y - m1 * x - m_change * x - b1 = y - m1 * x - b1 - m_change * x = e1 - m_change * x m_change = e1 / x

  • @Contradel

    @Contradel

    7 жыл бұрын

    I'm not sure I'm following you. But if, for one of the datapoints, the error is 1, you want to adjust the parameters (m and b) a small amount (learning_rate), weighted by error, so that for all your datapoints you get closer to a best fit.

  • @tigerspidey123
    @tigerspidey123 Жыл бұрын

    Would it be possible Applying PID control scheme to the learning rate, so it will accelerate our learning process?

  • @8eck
    @8eck4 жыл бұрын

    So the steer on the graph, it would be vertical line between Yguess and Yactual as a difference?

  • @lakeguy65616
    @lakeguy656166 жыл бұрын

    velocity in this example doesn't mean speed? but instead means heading?

  • @anuraglahon8572
    @anuraglahon85726 жыл бұрын

    Where is the code ??i am not finding it in github?

  • @8eck
    @8eck4 жыл бұрын

    So the so called steer is the delta of the weights? So called the change of weights in each iteration/epoch?

  • @aakashkamalapur8510
    @aakashkamalapur85107 жыл бұрын

    can anyone help me out in what way should I solve a system of over determined non linear equations?

  • @OneShot_cest_mieux
    @OneShot_cest_mieux7 жыл бұрын

    Hello, there is a traduction of your description and your title in french. I live in France and I can't disable this, how to do it please ?

  • @Bena_Gold
    @Bena_Gold5 жыл бұрын

    That "come back to me" ... hahahahaha

  • @sanjayshr1921
    @sanjayshr19216 жыл бұрын

    Awesome

  • @arijitdebnath4480
    @arijitdebnath44806 жыл бұрын

    why you multiply error * x by learning_rate??

  • @ac11dc110
    @ac11dc1105 жыл бұрын

    what is the best book for machine learning?

  • @sujansonly007ify
    @sujansonly007ify6 жыл бұрын

    is the desired velocity given ? , when i already know which direction is my target.. why would i choose other side and steer it ? Could someone please shed some light on desired velocity

  • @gonengazit
    @gonengazit7 жыл бұрын

    hey, nice video. could you explain why you normalize the values between 0 and 1 and what it does? i tried not normalizing them and i got some really wacky results using gradient descent even though it worked fine with the Ordinary Least Squares method. do you know why that happens?

  • @gonengazit

    @gonengazit

    7 жыл бұрын

    Julian atlasovich but it didn't work without normalization

  • @adaptine
    @adaptine7 жыл бұрын

    What you're describing here is effectively a kalman filter?

  • @nikhilnambiar7160
    @nikhilnambiar71605 жыл бұрын

    Make a video on lasso regression without library as did for linear regression

  • @hunarahmad
    @hunarahmad5 жыл бұрын

    Your snap has inspired Thanos :D

  • @iftikhar58
    @iftikhar58 Жыл бұрын

    Cost function in this video is mean sqaure error?

  • @souravsarkar5724
    @souravsarkar57244 жыл бұрын

    Dear sir, if you give any suggesion to understand that formula : "DELTA_m = error * x " , I will be very greatful .

  • @namanbhardwaj8230
    @namanbhardwaj82306 жыл бұрын

    which platform does he using?

  • @bosepukur
    @bosepukur7 жыл бұрын

    cool video

  • @nnmrts
    @nnmrts7 жыл бұрын

    Hey Dan! I really like your videos, but sometimes you seem so lonely in that studio. :D Wouldn't be something like a co-op coding challenge awesome?

  • @TheCodingTrain

    @TheCodingTrain

    7 жыл бұрын

    Hah, love this idea!

  • @BinaryReader

    @BinaryReader

    7 жыл бұрын

    great stuff Dan, this stuff is invaluable for anyone starting out in ML. top stuff.

  • @stefanoslalic2199

    @stefanoslalic2199

    6 жыл бұрын

    can you host me?

  • @user-tf9kn8xk7u
    @user-tf9kn8xk7u6 жыл бұрын

    Hey! Great Video! But...how is it possible that the line is self adjusting...According to the code..

  • @sreekrishnanr1812
    @sreekrishnanr18126 жыл бұрын

    I think you are awesome 😊😊

  • @charbelsarkis3567
    @charbelsarkis35676 жыл бұрын

    I would love to see the snapping of the fingers live :pp

  • @yogeshpandey9549
    @yogeshpandey95494 жыл бұрын

    Would you please elaborate the implementation of Gradient Descent Algorithm using vectorization method in python?

  • @TheCodingTrain

    @TheCodingTrain

    4 жыл бұрын

    Our Coding Train Discord is a great place to get help with coding questions ! discord.gg/hPuGy2g - The Coding Train Team

  • @toastyPredicament
    @toastyPredicament Жыл бұрын

    Sir, I wanted what they seem to have

  • @aasimbaig01
    @aasimbaig016 жыл бұрын

    0:05 Hahahah my complete life in 1 question

  • @akashsrivastava5963
    @akashsrivastava59637 жыл бұрын

    I need a code for linear regression for n variables in java

  • @iftikhar58
    @iftikhar58 Жыл бұрын

    Brother , Do you have any slack Channel or discord?

  • @mohammadpatel2315
    @mohammadpatel23153 жыл бұрын

    The concepts in this are very similar to the perceptron model

  • @NattapongPUN
    @NattapongPUN7 жыл бұрын

    What if multiple regression?

  • @williamobeng4703
    @williamobeng47036 жыл бұрын

    Well explained. it will be nice to see the code. Cant find it on github

  • @TheCodingTrain

    @TheCodingTrain

    6 жыл бұрын

    github.com/CodingTrain/website/tree/master/Courses/intelligence_learning/session3 (Need to figure out a way for things to be more findable!)

  • @bellindaakwa-asare4442
    @bellindaakwa-asare4442 Жыл бұрын

    great video!! where can I get the code?

  • @TheCodingTrain

    @TheCodingTrain

    Жыл бұрын

    Apologies that it is missing, please file an issue here! github.com/CodingTrain/thecodingtrain.com/issues

  • @tejasdevgekar1154
    @tejasdevgekar11547 жыл бұрын

    Really rookie right now... Gotta progress fast!

  • @frisosmit8920
    @frisosmit89207 жыл бұрын

    Maybe it would be cool if you made an AI for a simple game like noughts and crosses with a minimax algorithm

  • @r.d.machinery3749
    @r.d.machinery37495 жыл бұрын

    For a more complete and in depth discussion of Linear Regression with Gradient Descent check out Professor Andrew Ng of Stanford series of machine learning videos: kzread.info/dash/bejne/goSA0dJtfJXLd84.html

  • @solomonrajkumar5537
    @solomonrajkumar55372 жыл бұрын

    could you please share me this gradient descent code.

  • @xzencombo3400
    @xzencombo34007 жыл бұрын

    How old are you and how old you was when u started programming

  • @blackdedo93
    @blackdedo936 жыл бұрын

    Hey Thanks for The awesome video, i dont understand why not calculate the correct line directly ?

  • @DaSodaPopCop

    @DaSodaPopCop

    6 жыл бұрын

    The reason for this is because he is not simply writing a program that finds the correct line. He specifically is writing this program in such a way that implements and showcases the idea of back propagation. Calculating the line directly would be the most efficient way to write this program, but that's not the point of the video. There will be instances with much higher dimensional data where prognostication is much more efficient than doing what you suggest, such as in a Neural Network.

  • @DaSodaPopCop

    @DaSodaPopCop

    6 жыл бұрын

    look at 19:14 for his explanation

  • @blackdedo93

    @blackdedo93

    6 жыл бұрын

    makes sense Thanks. but can u give examples or reference on why would i need this learning process

  • @lucafilippini1348
    @lucafilippini13487 жыл бұрын

    PID ? As always thx Dan...

  • @adarshr3490
    @adarshr34905 жыл бұрын

    You have done the snap even before Thanos have done that =D