Linear Regression in Python from Scratch | Simply Explained

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

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

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

    I was searching for one resource where I can learn about machine learning.. after watching this video I found one great resource...
    Explanation was good.. but explain while writing code, don't skip to that writing part of coding, .
    Please Regularly come with great content like this..All the very best to this channel

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

      Okay... Thank You very much for your feedback. I will not skip the writing of codes from my next videos...
      And sure, i am coming up with content regularly

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

    I've been searching for exactly this implementation. Your the only one who implemented this Thanks it was really helpful.

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

      Thank You so much ! Its really good to hear that... I am glad that it was helpful to you 😇

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

    In X why are we having the first column as ones?

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

    Tried multiple vids for understanding this concept... finally understood after this vid...
    Great work...
    Subscribed

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

    when we do using gradient descent ,we consider partial derivative with respect to theta 0 and theta 1

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

    Why do u run written code fast ??? Some people may find it difficult to understand

    • @MachineLearningWithJay
      @MachineLearningWithJay  5 หลายเดือนก่อน

      Amm... I only fast forward the code that is not related to the concept I am teaching. I will consider this comment from next time onwards though

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

    Hi, thanks for a nice tutorial. One thing I did not understood is, why you are taking 1's in the X vairable as a first column ?

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

    hi bro u have done an excellent video please do more all the best

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

    Frankel, u should have 1M subs, bro!!

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

    it would be great if dataset used here would be available for absolute beginners, it is one of the easiest explanation to understand cost function and why gradient decent algorithm is being used to minimize the cost.
    A lot of minute details related to numpy & algorithms is being given here which help a novice to feel like champ.

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

      Thank you so much. Highly appreciate how you observed the details. Glad it was useful 🙂

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

    It’s a great explanation. In Machine Learning, I still wonder what can we get from the Linear Regression analysis. Could you explain us what information or advantages from LR analysis?

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

      It gives a sense of how predictive certain trends might be. Lineair regression is a way of predicting response variables to explanatory variables. If you know how much Y change for an n amount of X, then you can predict for example the earnings for next year based on how much you advertise etc.

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

    Thank you so much for the amazing stuff. Looking forward for your more videos.

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

    well explained JP i understood now thanks.

  • @RahulKumar-rf7yc
    @RahulKumar-rf7yc 4 ปีที่แล้ว +3

    Nicely explained sir💙💙

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

    good job. I have seen simple and multi-linear regression videos,. one question, why is that your implementation of both models not working with learning rates 0.01 and 0.001?
    [ I think it is the most commonly used values in regression]

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

    Nicely done bro! Simply Explained indeed! I would love to host you on my Channel sometime :)

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

      Hi Kunaal, you content and channel is great! I would love to colab with you too!

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

    Thanks for the short video. However, I needed some other videos and searching as a beginner.

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

    Why were you appending 1 when choosing random number to show the approximate prices?

  • @playwithcode_python
    @playwithcode_python 3 หลายเดือนก่อน

    But the cost function is actual value minues predicted value na ?

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

    thank you so much for the explanation sir but i'm confused why theta is taken zero what if we take any other values

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

      Thank You very much for your question. Your question made me learn something new as well.
      Here is my answer :
      We can initialize theta with any random values, but these values must be closer to zero. Or in other words, modules of theta should be small enough, so that its close to zero ( |theta| ~ 0 )
      If |theta| is too big, then | y_pred | becomes too big, and (y_pred - Y)^2 ( in cost function) becomes almost equal to y_pred^2 only, i.e, (y_pred - Y)^2= y_pred^2. Thus the model will not learn.
      There is no exact way of knowing how small |theta| should be to train our model well.
      So when we initialize theta to zeros, it adapts itself in such a way that y_pred becomes similar to Y, by minimizing the difference (y_pred - Y)^2. That's why we initialize theta with zeros and not with any other value, because it can lead our model to not train at all.
      I hope it helps !

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

      @@MachineLearningWithJay thank you so much for the answer

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

    why you have not taken partial derivative w.r.t0 theta 0 and theta 1 and update both

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

      Hi... I have taken partial derivatives that you are talking about. You can refer to my gradient descent video on linear regression. In that video, I have derived an expression after computing partial derivatives and I am using that expression here.

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

      @@MachineLearningWithJay taken only one derivative not other

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

      @@varshafegade4688 I have taken derivative w.r.t to both of theta 0 and theta 1. The equation has theta matrix, which has both theta 1 and theta 0. And thus the derivative is also taken for both theta 1 and theta 0, but is represented in 1 single equation by using matrix mutlplication.

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

      @@MachineLearningWithJay Thank you ,now I understood

  • @hooramirdamadi7513
    @hooramirdamadi7513 2 หลายเดือนก่อน

    Thanks to your very good videos, is there a way we can download data to try to code ourselves?

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

    Very Good videos, thank you!

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

    One thing about the code
    Please add resize on Y only after adding X = np.vstack((np.ones((X.size, )), X)).T (In the beginning phase of the code)

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

    Can you make a video about Python Decorators in complete detail and their uses in real-life applications?

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

      Hi Hana... I won't be able to make that video, coz it is not directly related to Machine Learning.
      You can refer to this link - www.geeksforgeeks.org/decorators-in-python/ I find geeksforgeeks articles very intuitive and easy to understand. Hope it helps.

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

      @@MachineLearningWithJay I will check it out 👍

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

    why d_theta doesn't have np.sum

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

    how to create that data set

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

      Hi, you can create a dummy dataset by just writing the data in a .txt or more preferably .csv file.

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

    Please do some math videos

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

      For sure Sakib ! More mathematical explaination of other Machine Learning models are coming !!

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

      @@MachineLearningWithJay i am excited😙😙

  • @kamlajoshi1854
    @kamlajoshi1854 2 หลายเดือนก่อน

    Bro please provide the dataset link as well, as that will be easier for us to move further

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

    How can we obtain a diminishing return from this analysis?

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

      Hi Sumaiya,
      Sorry, but I didn’t get your question. Can you please elaborate?

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

      Sure, I’m trying to do a linear regression on forecasting revenue based on what we spend. So, I’d like to understand at what point does spend stops affecting the revenue? Would you know how to obtain that from this regression analysis?

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

      @@sumaiyahashim3535 Sure.. I will need to to look at the problem statement.
      Can you mail me your contact details (whatsapp number with country code or any social media handle ) along with more information/resources/links on the problem you are trying to solve , at my mail - codeboosterjp@gmail.com ?
      I will let you know, if I can help you in any way further from there.

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

    bro , awsm it izzz😁😁

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

    Please add video on KNN

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

    can you please provide the dataset.txt file

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

      Hi, it was provided in the pdf notes. But here is the link again: github.com/Jaimin09/Beginners-Machine-Learning-Explained-Simply/blob/master/Assets/data.txt

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

    This is great… thanks

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

    🙌🙌🙌

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

    Everything is good but if you don't explain the code side by side, Its not that profitable as it should be.

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

      Thanks for the suggestion Divyam! From the next videos, I will be explaining code side by aide, and only skip the redundant explanations

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

    Why you write all this code??why you not just import regression model

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

      Thanks for your question. Writing the complete model helps us to understand how machine learning models work behind the hood. This way, we can later develop new complex models that are not available directly to import.
      There are many complex deep learning models in Computer Vision and Natural Language Processing. We need to understand these basic models to understand those complicated models.
      But yea, when we just want to use these simple regression models, then we have option to directly import and use them. And I will also make videos on how to do so, in future.

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

    d_theta = 1/m * np.sum(np.dot(x.T, y_pred - y))