How to do Multiple Linear Regression in Python| Jupyter Notebook|Sklearn

Поділитися
Вставка
  • Опубліковано 21 лип 2024
  • If you are new to #python and #machinelearning, in this video you will find some of the important concepts/steps that are followed while predicting the results in Multiple Linear Regression model. These steps are helpful, especially, while handling large number of observations in a dataset.
    The dataset used in this video is publicly available and therefore, easy to download and practice.
    Here is the link to the dataset: archive.ics.uci.edu/ml/datase...
    (Note: If multiple sheets are downloaded, the data in the sheet 1 is used in this video for analysis and if your data is downloaded in excel format, replace pd.read_csv with pd.read_excel while importing dataset in Jupyter)
    Hope you find this video helpful. Let me know your thoughts in the comment section below.
    I make videos on Tableau and Python on a regular basis. If you like this video, please don’t forget to subscribe.
    Happy Learning!
    #multiplelinearregression #python #jupyter #jupyternotebook #beginnerinmachinelearning #machinelearning #pythontutorial #regression #scikitlearn #sklearn

КОМЕНТАРІ • 192

  • @cowjacketstudiostm5902
    @cowjacketstudiostm5902 3 роки тому +20

    Literal queen. Been crying for a week over this. I could've just watched this, this is amazing.

  • @omarelliottgreen823
    @omarelliottgreen823 2 роки тому +18

    After 6 hours of stumbling through StackOverflow and various books, this video made it clear in 20 minutes!
    Thank you SO MUCH!!!

  • @vikrantyadav7379
    @vikrantyadav7379 2 роки тому +9

    This is the best tutorial i have come across ... simple ,easy and beautiful.
    Please upload other regression and classification problems.

  • @mizanalisayed9022
    @mizanalisayed9022 3 роки тому +3

    Since 2 days i am trying to understand ML. Finally abhi ache se samajh gaya. Thanks

  • @tammu478
    @tammu478 2 роки тому +1

    Beginning my ML journey. Thank you for the crisp explanation.

  • @special1_28
    @special1_28 Рік тому

    Hi Megha, you are a mega tutor indeed. You're more than awesome. Without any gaining, this is the best explanation and best perspective I have come across on youtube regarding ML. You're superb ma'am. I await more of your uploads.
    Thank you!

  • @b048peyyettipavankartikpra4
    @b048peyyettipavankartikpra4 3 місяці тому +1

    Amazing video! This is my first project ever and I hope to continue further in my career of Data Science!

  • @mallelasunny
    @mallelasunny 2 роки тому +8

    Hi Megha...the explanation is neat and clean...right at the point. Very beautifully explained and the concept is clear. Can you please upload more videos on Logistic Regression, KNN, Random forest, Support Vector machines, Decision tree etc?

  • @CFDAsmaaHadane
    @CFDAsmaaHadane Рік тому +1

    Thank you for this very informative tutorial! Please keep uploading

  • @Deepsim
    @Deepsim 2 роки тому

    I really like your well organized presentation structure!

  • @lookaway8496
    @lookaway8496 Рік тому

    So good! this is much simpler explanation. I love it

  • @sudarshandev6369
    @sudarshandev6369 3 роки тому +1

    Wow really its very easy to understand, Mam your sequence wise explanation is awesome.

  • @shantanulokhande1792
    @shantanulokhande1792 3 роки тому +2

    Thank you so much. It was really helpful!!!

  • @PaoloCondo
    @PaoloCondo Рік тому

    Thank you so much for the video!

  • @kodtld
    @kodtld 2 роки тому +1

    Really helpful tutorial! Thank you.

  • @taniacai5245
    @taniacai5245 2 роки тому +1

    Hi Megha, thank you so much for the video! It helped me a lot in work.
    Really appreciate! hope you keep making that

  • @hanifullah1088
    @hanifullah1088 2 роки тому +1

    Very clear and to the point . . . .kindly make similar videos for each topic such as Decision tree classifier etc

  • @samarthchakrawartiblogsand4809

    For a beginner this video is a big help!!

  • @yusiferzendric1489
    @yusiferzendric1489 2 роки тому +1

    I only had difficulty in plotting the model, thanks a lot 😃😃👍👍

  • @EddyFisico
    @EddyFisico 8 місяців тому

    This is a very good video! Thank you very much!

  • @ranulmbalasooriya659
    @ranulmbalasooriya659 2 роки тому +1

    Thank you so much for the clear explanation.

  • @resreng
    @resreng Рік тому

    Thank you so so so much for clearing the concepts.

  • @JawadAhmadKhan
    @JawadAhmadKhan 2 роки тому

    one of the best explanations in very simple words... Bravo Miss Megha Narang

  • @JewelWildmoon
    @JewelWildmoon 2 роки тому +8

    Quick extra note for anyone since I was stuck on it for a bit.
    If you have any columns you want to exclude beforehand (for me, it kept picking up data with string values too and I wanted to exclude those), run this first for those columns before defining x and y:
    data_df.drop(['Column1', 'Column2', 'etc..'], axis=1, inplace=True)
    Using "inplace=True" will make it so those columns will stay out of the dataframe because if you define it as "inplace=False" or don't define it at all, those columns you removed will go back into the dataframe anyway. It wasn't used in defining x and y because we need the column PE to return to the dataframe.
    And thank you so much for this video miss Megha. I'm new to Python and have been struggling with this for an assignment for hours and this really helped me.

  • @avinashsiripuram1058
    @avinashsiripuram1058 3 роки тому

    Great explantion ............ur work must be admired

  • @alyaaazlan7794
    @alyaaazlan7794 Рік тому +1

    This is sooooo Great!!!

  • @pursuingperfectionn
    @pursuingperfectionn 2 роки тому

    Simply Brilliant !!

  • @yangelena7135
    @yangelena7135 2 роки тому +2

    Hi thank you for sharing. But I am wondering how do you get the actual linear regression equation with sklearn

  • @arjunramprasad6752
    @arjunramprasad6752 2 роки тому +1

    Amazing tutorial!

  • @girishchhonkar9391
    @girishchhonkar9391 2 роки тому

    Great explanation mam...just simple and smooth 😃..keep uploading videos

  • @emanuelbyas9819
    @emanuelbyas9819 2 роки тому +1

    Thank you so much! Super Clear!

  • @renato.aravena4051
    @renato.aravena4051 2 роки тому

    Cleannn tutorial, the best of all, thx :))

  • @samahabdalrahim3709
    @samahabdalrahim3709 3 роки тому +1

    thanks a lot, please I want to know which algorithm is used (batch, stochastic...?) also can we show the cost function?

  • @shahzebmohammad9521
    @shahzebmohammad9521 3 роки тому +9

    Simple, Clear, Concise. What else do you want?

  • @jongcheulkim7284
    @jongcheulkim7284 3 роки тому

    Thank you so much. This is very helpful.

  • @anuarohi2335
    @anuarohi2335 4 місяці тому

    Very meaningful session, great explanation 👍

  • @bonganindlovundlonu3239
    @bonganindlovundlonu3239 2 роки тому +1

    Awesome video. keep on doing great

  • @wahu9578
    @wahu9578 2 роки тому +1

    @ Megha, thank you for this. Have you done another video of a way to improve the model? If so, can you kindly share the link?

  • @indointanchannel
    @indointanchannel Рік тому

    Thanks sist, you help me to understand about a long code becomes a short code. It's a smart video.

  • @greenfootprint2680
    @greenfootprint2680 Рік тому

    Great breakdown! Liked and Sub 👌

  • @ca2hill
    @ca2hill 2 роки тому +1

    So useful!!! Thank You

  • @otenyop
    @otenyop 9 місяців тому

    Excellent!

  • @pinkysaikiadutta9752
    @pinkysaikiadutta9752 2 роки тому

    Very nice explanation. Thanks!! for the explanation

  • @EugegegeSky
    @EugegegeSky 2 роки тому +1

    you are the best!!

  • @norahassan3407
    @norahassan3407 2 роки тому

    very insightful many thanks for your impressive work

  • @waqasrana7891
    @waqasrana7891 2 роки тому +1

    Hi Megha, thanks for tutorial. what if we have string in datasets (like types can be multiple strings not boolean e.g colors:blue, red, green ,black ) how we will convert it into float format cuz model only understands numbers.

  • @abdullahateeq1236
    @abdullahateeq1236 2 роки тому +1

    Thank you for the visualization.... :)

  • @petelok9969
    @petelok9969 2 роки тому

    Fantastic tutorial. Question I have is if I wanted to test my model on another dataset how could I do it once I have my coefficients and intercept? Best Wishes Peter

  • @datawithalvin
    @datawithalvin 2 роки тому +1

    thank you so much this video help me to understand the concept faster

  • @sunandadebnath96
    @sunandadebnath96 2 роки тому +1

    you are life saver

  • @nihinlolakukoyi5987
    @nihinlolakukoyi5987 2 роки тому

    In wish I can give this video a million likes.... thank you very much.. this video was really helpful.

  • @mansoorahmed4150
    @mansoorahmed4150 3 роки тому

    could you please tell more, using multiple regression which technique you follow? I mean OLS or else?

  • @KiratAlreja
    @KiratAlreja 3 роки тому

    Mam, how do we predict multiple target values (y variables) with a single linear regression model?

  • @shakirullah5840
    @shakirullah5840 3 роки тому

    Very nice video. Thank you so much and Best of luck--Shakir, Bangladesh

  • @Eddyyc
    @Eddyyc 3 роки тому +1

    Hi Megha, thanks for this great video, very simple question may be for you, on your predicted values chart, is there a way to plot a straight line across those values?

    • @aju5405
      @aju5405 3 роки тому +1

      Like simple linear regression?

  • @richardosborn3810
    @richardosborn3810 2 роки тому

    Thank you!

  • @feralvarez8133
    @feralvarez8133 Рік тому

    THANKYOU GREAT VIDEO

  • @owonubijobsunday4764
    @owonubijobsunday4764 Рік тому

    I liked the video, so I "Liked" and I "Subscribed"
    Thanks, MN

  • @dhananjayavijebahu6667
    @dhananjayavijebahu6667 3 роки тому +1

    Clear and Nice explanation....

  • @adityajawla723
    @adityajawla723 2 роки тому

    Hi Thanks for the informational video, it is very easy to understand.

  • @vinayshukla3800
    @vinayshukla3800 2 роки тому +1

    GREAT WORK MEM👏👏👏👏👏

  • @vijaybhatt8060
    @vijaybhatt8060 2 роки тому

    simply awesome

  • @NK-vd8xi
    @NK-vd8xi 2 роки тому

    What keyboard are you using? It sounds so soothing.

  • @danielstafford6858
    @danielstafford6858 3 роки тому +1

    brilliant video

  • @cemilisilak2966
    @cemilisilak2966 2 роки тому

    thx for video a lot. But what about the prediction of finding most minimum value in according to independents variables. How can we find it? thanks in advance

  • @priyankasahu6629
    @priyankasahu6629 Рік тому

    Thank you so much ❤️

  • @minhngo3162
    @minhngo3162 9 місяців тому

    Hi Megha, thanks for showing steps by steps. I have a question. Instead plotting the result by "Actual" and "Predicted", can we visualize the predicted vs. actual ''y" for each variable"x"? Can you please advise the codes? Thank you.

  • @dhaneshsarpale1718
    @dhaneshsarpale1718 3 роки тому +1

    simple explanation... Thank you mam

  • @myandrobox3427
    @myandrobox3427 2 роки тому +1

    Excellent💯👍

  • @lekhrajmalviya4927
    @lekhrajmalviya4927 Рік тому

    Very nice explaination. Could you please tell how we can get equation for the predicted model?

  • @APPRENTINazmi
    @APPRENTINazmi 3 роки тому +1

    very nice and easy teaching. Congrats.

  • @srikanthgiri2781
    @srikanthgiri2781 2 роки тому +2

    hi ,
    Thanks for this amazing video!
    If we need to print the linear regression equation in the form of y= a+bx1+cx2 , how to do that?

    • @googm
      @googm Рік тому

      Do `dir(ml)` and you will see a list of attributes. You'll find what you're looking for in ml.coefs_ and ml.intercept_.

  • @SanaShaikh-sm7kz
    @SanaShaikh-sm7kz 3 роки тому +1

    Thanks a lot..this video has helped me a lot in my project❤❤❤❤

  • @chinojordan6485
    @chinojordan6485 3 роки тому

    Gracias, me ayudo mucho tu video :)

  • @ankitmaithani3558
    @ankitmaithani3558 2 роки тому +1

    Great Ma'am

  • @SandeepYADAVggn
    @SandeepYADAVggn 2 роки тому

    Brilliantly explained. Can u make video for deployment of model to use with webpage/android or any programming language GUI through API . Also make such a beautifully explained video for ANN also.

  • @user-es4gp9we7s
    @user-es4gp9we7s Місяць тому

    thanks for this video

  • @ShiftKoncepts
    @ShiftKoncepts 3 місяці тому

    Do you have a guide on how to do multiple variables if they are non linear? Meaning we’d have to use a polynomial method with degrees?

  • @sreekanthreddy7452
    @sreekanthreddy7452 2 роки тому +1

    Keep it up and make videos on other models too mam.

  • @An-yq6oy
    @An-yq6oy 2 роки тому

    Very useful

  • @kenjalgundecha5870
    @kenjalgundecha5870 3 роки тому

    Very Nice Megha..Just if you give some explanation of functions which are using then it will be more clear. Nice Attempt!!!

  • @motuagrakalam7749
    @motuagrakalam7749 2 роки тому +1

    Really nice explanation. One question, in the final regression equation can we have 0 as coefficient for any independent variable or all variables will be assigned some non 0 values?

    • @souptikdasgupta2062
      @souptikdasgupta2062 2 роки тому

      It should always have a non zero value because if it is zero it would mean that the specific independent variable is totally useless to predict the dependent variable, which never is the case.

    • @christopherwright361
      @christopherwright361 2 роки тому

      Because you're estimating from a sample, it would be nearly impossible for a variable to have a coefficient of 0, even if there isn't any correlation between the dependent variable and the independent variable (within the context of your model) in the real process. If you ever get a zero coefficient, it's likely due to an error such as including a redundant feature, having perfect (multi)collinearity, including k dummy variables (and an intercept) for k cases, etc. This can be fixed by reducing the feature set (one at a time, of course.)

  • @raj4624
    @raj4624 3 роки тому

    Nice video mam .. God bless you ☺️

  • @jaydeepraut820
    @jaydeepraut820 3 роки тому +7

    Hi, your videos are awesome and easy to understand. Can you please upload the logistic regression, random forest, SVM and times series modeling videos with examples.

    • @MeghaNarang
      @MeghaNarang  3 роки тому +2

      sure, will try to upload something soon

    • @jaydeepraut820
      @jaydeepraut820 3 роки тому

      Thank you very much, and please upload with the dataset available on the internet, so that we can try on our own.

    • @billwindsor4224
      @billwindsor4224 2 роки тому

      @@jaydeepraut820 did you try to search in Google for the dataset described, as she showed and explained it at the video timestamp @1:10 and following? As she describes this in the video, it is straightforward to search and find from Google.

  • @tarunkumargola7633
    @tarunkumargola7633 3 роки тому

    Finding the parameter at which cost function gives minimum value(gradient descent) is done by scikitlearn?

    • @MeghaNarang
      @MeghaNarang  3 роки тому

      towardsdatascience.com/minimizing-the-cost-function-gradient-descent-a5dd6b5350e1

  • @sadhanabarman3178
    @sadhanabarman3178 Рік тому

    Ma'am can we get regression for more than 2 independent variables w.r.t more than two dependent variable??

  • @atoffice7323
    @atoffice7323 3 роки тому

    very nice presentation..

  • @christopherwright361
    @christopherwright361 2 роки тому

    What do see as the advantage of using the sklearn's LinearRegression vs. statsmodels.OLS? The summary() and summary2() results tables from the latter are nice for seeing a whole lot of information at once.

  • @prabirdas8430
    @prabirdas8430 3 роки тому +1

    Nice explanation 👍🏻

  • @sukh172
    @sukh172 2 роки тому

    hello Megha, this is good one , easy for beginner ....kindly upload on clustering neural network also

  • @yusufsedatozdemir5522
    @yusufsedatozdemir5522 2 роки тому +1

    thank you so much

  • @ikennanwankpa6354
    @ikennanwankpa6354 Рік тому

    Thanks for the video. I built a model to predict rent across my country. The accuracy score is 43% or so. What can I do to improve it? I can send the script of needed. Thanks.

  • @venkateshvajja3666
    @venkateshvajja3666 3 роки тому

    Superb explanation madam thank you

  • @azizinaim8470
    @azizinaim8470 3 роки тому

    hi, can i ask, why my df not defined , do i need to do anything before put the coding as you..im a beginner, would be great if you can reply this :)

  • @dianahnyamweya1393
    @dianahnyamweya1393 2 роки тому

    What happens if one of the variables has string values instead of numerical values?

  • @ayoajayi280
    @ayoajayi280 6 місяців тому

    Hello Megha. Great video. But you did apply the scaler function to standardize the days. Why?

  • @akshayjadhav2003
    @akshayjadhav2003 Рік тому

    After define x & y print statement should be came in " str " how it is possible if all dataset and format as it is copy .🤔

  • @sam-mv6vj
    @sam-mv6vj 2 роки тому

    Very well done mam,why didn't you do outlier treatment mam ?

  • @sanketvirani8584
    @sanketvirani8584 Рік тому

    Thank you

  • @olanrewajubakare3790
    @olanrewajubakare3790 2 роки тому +4

    I really appreciate your work, however, I will like to point something I noticed out.
    The scatter plot you created for your result at the end of the analysis where you had the y_test plotted against the y_pred seems inaccurate to me. plt.scatter(y_test, y_pred) is supposed to indicate that your y_test is on the x-axis while your y_pred. is to be plotted on the y-axis. I believe what you should do is showcase the y_test and y_pred on the y-axis while you use a common x-axis for the two on the same plot.

    • @christopherwright361
      @christopherwright361 2 роки тому +1

      Two different ways of showing the same basic thing. y_pred vs. y_test will form a 45-degree straight line if the data is perfectly predicted, whereas y_test and y_pred both vs. x_test will show the points overlapping each other, if perfectly predicted. However, because this is multiple regression, there isn't a single x variable, so you would have several of the latter plots. These are useful for certain diagnostics. However, a very common first plot is y_test vs. y_pred. Plotting residuals vs. y_test or x_test (one at a time) are also common charts to make.