Linear Regression Cost Function | Machine Learning | Explained Simply

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ม.ค. 2025

ความคิดเห็น • 162

  • @MachineLearningWithJay
    @MachineLearningWithJay  4 ปีที่แล้ว +11

    If you found any value from the video, hit the red subscribe and like button 👍. I would really love your support! 🤗🤗
    👉 You will get a New Video on Machine Learning, every Sunday, if you subscribe to my channel, here : th-cam.com/channels/JFAF6IsaMkzHBDdfriY-yQ.html

  • @HailayKidu
    @HailayKidu 2 ปีที่แล้ว +5

    This is my first time accessing such a video and it is a clear way of description, thank you!

  • @codingstyle9480
    @codingstyle9480 ปีที่แล้ว +7

    Dividing the cost function by 2 is not for finding the average. It is just for convenience when the squared function is differentiated, the nominator gets a 2 for multiplication factor. So to eliminate this we just put a 2 in the denominator, I suppose.

  • @HengChamroeunboysmall
    @HengChamroeunboysmall 2 ปีที่แล้ว +1

    The lesson from my professor(formula without demonstraton) make me sleepy all the time, but u make it look very simple problem and understandable. Thank you!

  • @nikhilsastry6631
    @nikhilsastry6631 3 ปีที่แล้ว +2

    That's great as I took a premium course from google.... I came here for revision, as I wonder if you could explain it in simpler terms.... Great explanation 👍

  • @rasengan9743
    @rasengan9743 2 ปีที่แล้ว +7

    You got a new sub man, i didn't know this can be this simple, i really appreciate it.

  • @madhoounni
    @madhoounni 8 หลายเดือนก่อน

    You are a GEM. explaining in simple words with drawing.

  • @morenomt27
    @morenomt27 3 ปีที่แล้ว +2

    WOW! Thank you for this.. I had been trying to look everywhere which simplifies the explanation of Mean Squared Error and what its purpose into few minutes and you did superb! Just in time for my research.

  • @muaazi13
    @muaazi13 4 ปีที่แล้ว +4

    Explained in such easy to understand language, this was my first video tutorial and I understood it pretty well.
    Thank you.

    • @MachineLearningWithJay
      @MachineLearningWithJay  4 ปีที่แล้ว +1

      I am very glad to be able to help you! Your comment really means alot to me.. Thanks alot !!

  • @rockysingh2200
    @rockysingh2200 3 ปีที่แล้ว +1

    Thanks for explaining in the best possible and easy way. I was finding this very hard but after watching this video I understood it

  • @raselkarim2731
    @raselkarim2731 3 ปีที่แล้ว +1

    Than you! Very clear explanation, never imagined this would be such easy to understand.

  • @Murmur1131
    @Murmur1131 4 ปีที่แล้ว +3

    I love it. Greetings from Germany!

  • @EmoblazeXD
    @EmoblazeXD 3 ปีที่แล้ว +4

    The 2 exponent is there to eliminate negative numbers and not because of the magnitude of the data points. If anything squaring would make them even larger.

    • @MachineLearningWithJay
      @MachineLearningWithJay  3 ปีที่แล้ว

      Yes right . Making them larger won’t be a problem, because the graph of cost vs weight will remain the same way, and we will be able to reach to the local minima of that graph.
      You can try once by taking absolute value without squaring, and then try again with taking square, you will get the same accuracy and results in both cases.

  • @habibullahsarker4339
    @habibullahsarker4339 2 ปีที่แล้ว +1

    Easy to understand this video. Thanks, coding lane.

  • @jeevapriya4853
    @jeevapriya4853 4 ปีที่แล้ว +1

    jz luv the way u gave the intro ..... it's quite easy to learn from ur videos

  • @Jesuschrist-x4p
    @Jesuschrist-x4p 5 หลายเดือนก่อน +2

    best explanation on cost function. Thank you for making it so simple!

  • @theforester_
    @theforester_ 3 ปีที่แล้ว +1

    really good explanation! thanks very much. greetings from brazil

  • @hemantsah8567
    @hemantsah8567 4 ปีที่แล้ว +1

    Brief... Explanatory... Great....

  • @devanshishah532
    @devanshishah532 6 หลายเดือนก่อน

    This was such a great explanation! thank you !!!!

  • @johans7585
    @johans7585 2 ปีที่แล้ว +1

    Thank you man! Keep it up 💪

  • @bmuralikrishna8054
    @bmuralikrishna8054 3 ปีที่แล้ว +5

    Hello, JP. You explained it really very well. Thank a lot.
    Just have a query... why do we apply square for our cost function. is it really necessary?

    • @MachineLearningWithJay
      @MachineLearningWithJay  3 ปีที่แล้ว +2

      Hi Murali, you either need to square the cost function or take modulus of it.
      What we want is positive number for the difference between actual value and predicting value.
      Otherwise we will not be able know how large is our error.
      For eg, if our error differences are 3, -4, 2. Then cost should be = (3 + 4 + 2 )/3 = 3.
      If we don’t square or take modulus of these errors then it will mislead us giving the cost function value to be = (3 - 4 + 2 )/3 = 0.33

    • @bmuralikrishna8054
      @bmuralikrishna8054 3 ปีที่แล้ว +2

      @@MachineLearningWithJay thanks a lot for your quick reply. I really understood it in now in very good manner.
      I really appreciate your effort for teaching others.

  • @johnnynguyen7657
    @johnnynguyen7657 3 ปีที่แล้ว +3

    You sir should be a professor

    • @MachineLearningWithJay
      @MachineLearningWithJay  3 ปีที่แล้ว +1

      I am just a student for now . Thank You so much ! It really means a lot to me ! I am glad my videos helped you.

  • @theoronno7709
    @theoronno7709 ปีที่แล้ว +1

    That is a very much good explanation. thanks for your this help

  • @cleisonarmandomanriqueagui9176
    @cleisonarmandomanriqueagui9176 7 หลายเดือนก่อน

    cost function can be any function for those who are asking why dividing by 2 . of course the ones that makes sense and we can minimize is a function power of 2 so that's why

  • @shajanreynold8545
    @shajanreynold8545 4 ปีที่แล้ว +2

    nice explanation about the cost funtion bro understood the concept

  • @mohammadawwad7832
    @mohammadawwad7832 2 ปีที่แล้ว +1

    Thanks man, very good job !

  • @cristianistrying7866
    @cristianistrying7866 3 ปีที่แล้ว +1

    Excellently explained, thanks!

  • @-alfeim2919
    @-alfeim2919 2 ปีที่แล้ว +1

    Great math explanation!

  • @987dan987
    @987dan987 3 ปีที่แล้ว +1

    Thank you for this excelent class!

  • @ivelinkarageorgiev3111
    @ivelinkarageorgiev3111 2 ปีที่แล้ว +1

    Thanks man , that was an excellent explanation^^, keep rocking \m/

  • @nandiniyadav5337
    @nandiniyadav5337 3 ปีที่แล้ว +1

    Very well explained. U are amazing 😊

  • @kevinalexis9886
    @kevinalexis9886 3 ปีที่แล้ว +1

    This really helped thanks!

  • @stephenmurphy5055
    @stephenmurphy5055 3 ปีที่แล้ว +1

    Really well explained! Thanks!

  • @KSanofficial
    @KSanofficial 3 ปีที่แล้ว +1

    Very clear explanation. Thank you for the video!

  • @ekleanthony7735
    @ekleanthony7735 2 ปีที่แล้ว +1

    Nice explanation dude

  • @BigAl6405
    @BigAl6405 3 ปีที่แล้ว +1

    GOod explanation. Thanks!

  • @vinayakpatil5214
    @vinayakpatil5214 3 ปีที่แล้ว +1

    thanks bro explanation is superb

  • @mhrmidbencher
    @mhrmidbencher 28 วันที่ผ่านมา +1

    Thanks brother❤

  • @kmanju6854
    @kmanju6854 3 ปีที่แล้ว

    Woow nice explanation 👏👌

  • @rahar6009
    @rahar6009 3 ปีที่แล้ว +1

    This was awesome thank you so much

  • @jasonkhongwir1302
    @jasonkhongwir1302 4 ปีที่แล้ว +2

    great tutorial !

  • @bruh-hp3hu
    @bruh-hp3hu 3 ปีที่แล้ว +1

    thank you this was perfect

  • @tejaspatil3978
    @tejaspatil3978 3 ปีที่แล้ว +1

    Are you from india.. your english accent is good..
    And btw video is nice..

  • @serene3202
    @serene3202 3 ปีที่แล้ว +2

    Are u student of prof. Andrew Ng? Your teaching style is very much similar to him. Anyway thank you for a great video.

    • @MachineLearningWithJay
      @MachineLearningWithJay  3 ปีที่แล้ว +1

      I learned ML first from him only... and really liked his teaching. Yea... and that is why my teaching style has been adapted to his. Good to know that you found my video helpful.

  • @siamami9177
    @siamami9177 2 ปีที่แล้ว +1

    Great explanation, but didn't get the point of multiplying with 1/2m in case of squared or 1/m in case of absolute. Thank You

    • @MachineLearningWithJay
      @MachineLearningWithJay  2 ปีที่แล้ว

      I have explained that in comments section below… you can have a look at it… it might help

  • @salahokba6837
    @salahokba6837 4 ปีที่แล้ว +1

    Cool video thank U ...when you try to tune for example the PI control Gains (kp, ki) of a closed loop sys by " genetic algorithm " the cost is the same as fitness function ...and if want to suggest to me any thing can help to code this in matlab. Thanks again for the effort

  • @matahariramadhan
    @matahariramadhan ปีที่แล้ว

    great video, thanks

  • @AJ-vq9ym
    @AJ-vq9ym 3 ปีที่แล้ว +1

    good explanation

  • @dens3254
    @dens3254 ปีที่แล้ว

    In this example you initiated randomly a curve. But in fact, how can we initiate the first equation/curve/line?

  • @blu_silver
    @blu_silver 3 ปีที่แล้ว +1

    Thanks bro 😜👍

  • @soryegetun529
    @soryegetun529 3 ปีที่แล้ว +1

    thanks soo so much mate.

  • @MahmudulSajib-x5e
    @MahmudulSajib-x5e ปีที่แล้ว

    Hi, great lecture. Besides your lectures, which book or online course would you recommend to learn ML topics (KNN/SVM etc.) in depth?

    • @anuragpanda7058
      @anuragpanda7058 11 หลายเดือนก่อน

      did you find a book like that?

  • @malihanadeem4854
    @malihanadeem4854 4 ปีที่แล้ว +2

    Can someone please explain why did we multiply by 1/2m?

    • @MachineLearningWithJay
      @MachineLearningWithJay  4 ปีที่แล้ว +4

      Hello Maliha, thanks for your question.
      As we are taking the sum of squared errors of all m datapoints, dividing it with (1/m) will give us the average. Thus we multiply (1/m) to get the average of squared error.
      You can choose to multiple (1/2m) or (1/m), it wont affect our model.
      But multiplying (1/2m) makes the expression mathematically simple when we are dealing with squared error.
      Hope it helps! Let me know.

    • @malihanadeem4854
      @malihanadeem4854 4 ปีที่แล้ว +1

      @@MachineLearningWithJay Thank you for the response! I finally get it

    • @ahmetozel3011
      @ahmetozel3011 2 ปีที่แล้ว

      @@MachineLearningWithJay worse language i have ever seen. Bro she asked 2/m. i already know why we multiply with 1/m but why 2? WHY 2 TWO

  • @supriyamanna715
    @supriyamanna715 3 ปีที่แล้ว +1

    my qn is why the square is taken? modulas was okay but why sq? next, I'm not getting why again 1/2m is needed, 1/m is okay for average but again the 1/2??

    • @MachineLearningWithJay
      @MachineLearningWithJay  3 ปีที่แล้ว

      Hi Supriya... good question... the answer of this is already given in comments below.

  • @nurudeenmohammediyam9221
    @nurudeenmohammediyam9221 12 วันที่ผ่านมา

    what of entropy?

  • @mussabafridi
    @mussabafridi ปีที่แล้ว

    thank you so much dudee

  • @pujaroy7182
    @pujaroy7182 11 หลายเดือนก่อน

    He is just great

  • @akshayjadhav2213
    @akshayjadhav2213 4 ปีที่แล้ว +1

    cool video!!

  • @Karthik-yy6up
    @Karthik-yy6up 3 ปีที่แล้ว +1

    I honestly don't get why you squared it, and divided it by 2m. What's the problem in just considering the summation of all distances?

    • @MachineLearningWithJay
      @MachineLearningWithJay  3 ปีที่แล้ว +1

      (Y - y_hat) can be negative (when our straight line is above a point), so it will lead to wrong answer if we just sum it. So if you don’t want to square it, then take its modulus i.e, | Y - y_hat | .
      And about the 2m, i have already answered that in the comment down below. Do check that out.

    • @Karthik-yy6up
      @Karthik-yy6up 3 ปีที่แล้ว +1

      @@MachineLearningWithJay Thanks for the response 😀

  • @bhargavsai2449
    @bhargavsai2449 3 ปีที่แล้ว +1

    excellent

  • @sumerujain3057
    @sumerujain3057 3 ปีที่แล้ว +1

    Thanks man

  • @amaankhilji9810
    @amaankhilji9810 3 ปีที่แล้ว +1

    you explained better than Andrew ng honestly

  • @drelijahmikail3916
    @drelijahmikail3916 7 หลายเดือนก่อน

    why 2m specifically? There are differences of 2m points, but there are only m values.

  • @abdelrahmane657
    @abdelrahmane657 2 ปีที่แล้ว

    Excellent

  • @Icandleii
    @Icandleii ปีที่แล้ว

    Thank you so much

  • @thepythonprogrammer4338
    @thepythonprogrammer4338 3 ปีที่แล้ว +1

    Thanks mate

  • @bob77097
    @bob77097 3 ปีที่แล้ว +21

    Good job. Just please stop trying to force an american accent. Doesn't matter what accent you have, you are intelligent enough to explain tought concepts to everyone. Just be you

    • @MachineLearningWithJay
      @MachineLearningWithJay  3 ปีที่แล้ว +4

      Thank you so much ! And I am not trying to force my accent, its now natural to me 😅. I am glab that you found my videos helpful.

    • @mohamedelsabbagh5681
      @mohamedelsabbagh5681 11 หลายเดือนก่อน +2

      He is not trying,actually i enjoed his videos though I don’t like to hear indian accent-@the channel onwer u did great

  • @BTae9293
    @BTae9293 2 ปีที่แล้ว +1

    Thank you

  • @farhansomali1091
    @farhansomali1091 4 ปีที่แล้ว +1

    Thank you.

  • @jahnavibehara5823
    @jahnavibehara5823 2 ปีที่แล้ว +1

    thank you :)

  • @rahmatulakbar6748
    @rahmatulakbar6748 2 ปีที่แล้ว +1

    Why you devide by 2

  • @franciscogalvez4163
    @franciscogalvez4163 2 ปีที่แล้ว +1

    I think that theres an error i your cost formula, isnt (y-y^) its (y^-y).

    • @franciscogalvez4163
      @franciscogalvez4163 2 ปีที่แล้ว

      Actually in the implementation withh Python you use this (y^-y)

    • @MachineLearningWithJay
      @MachineLearningWithJay  2 ปีที่แล้ว

      Hi Francisco, it’s appropriate.

    • @franciscogalvez4163
      @franciscogalvez4163 2 ปีที่แล้ว

      @@MachineLearningWithJay Please upload more videos with other models...
      Are very helpfull

  • @geezgus
    @geezgus 8 หลายเดือนก่อน

    thankyou!!

  • @imtiaziqbal3041
    @imtiaziqbal3041 ปีที่แล้ว

    why divide by 2M?

  • @AnkitKumar-ss7sx
    @AnkitKumar-ss7sx 3 ปีที่แล้ว +1

    Great explanation brother

  • @HettyPatel
    @HettyPatel 3 ปีที่แล้ว +1

    ty

  • @vsmemegenix3512
    @vsmemegenix3512 ปีที่แล้ว +1

    It should be y predicted - y actual

  • @youbeyou9769
    @youbeyou9769 ปีที่แล้ว +1

    Your hands are pretty 😂

    • @MachineLearningWithJay
      @MachineLearningWithJay  ปีที่แล้ว +1

      Haha… thanks! Its the most unique compliment I have received 😁

  • @narendrapratapsinghparmar91
    @narendrapratapsinghparmar91 ปีที่แล้ว

    Thanks

  • @AaftabShaikh567
    @AaftabShaikh567 2 ปีที่แล้ว +1

    I think the formula of cost function in this video isn't right

    • @MachineLearningWithJay
      @MachineLearningWithJay  2 ปีที่แล้ว

      Hi Aaftab, it is correct. There can different cost function formulas, depending on the type of model you are creating.

  • @ijajahmed3618
    @ijajahmed3618 4 ปีที่แล้ว +2

    go ahead

  • @khaledsrrr
    @khaledsrrr ปีที่แล้ว

    nice

  • @ajaykushwaha-je6mw
    @ajaykushwaha-je6mw 3 ปีที่แล้ว +1

    what is the catch behind fake accent.

    • @MachineLearningWithJay
      @MachineLearningWithJay  3 ปีที่แล้ว

      Its now kind of natural to me 😅. But i will improve to have more of an Indian accent

  • @neturonix
    @neturonix 4 ปีที่แล้ว +1

    👍👍👍👍👍👍👍

  • @fullbridgerecrifier
    @fullbridgerecrifier 3 ปีที่แล้ว +1

    💯

  • @Tejaswi-s5b
    @Tejaswi-s5b ปีที่แล้ว

    Zesty