Regularization Part 3: Elastic Net Regression

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ก.ย. 2024

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

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

    NOTE: In this video, for some reason I used the word "variable" instead of "parameter" in the equations for elastic-net. We are trying to shrink the parameters, not the variables.
    Support StatQuest by buying my book The StatQuest Illustrated Guide to Machine Learning or a Study Guide or Merch!!! statquest.org/statquest-store/

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

      Clarification: Params {slope, intercept}. Variable {weight, hight} - for anyone that got confused

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

      @@badoiuecristian Exactly.

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

      3:56 "...when there are correlations between parameters..." this should be between variables instead. Similarly at 4:48 "...job dealing with correlated parameters..."

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

      @@s25412 Oops! You are correct.

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

      Hi Josh,
      Love your content. Has helped me to learn a lot & grow. You are doing an awesome work. Please continue to do so.
      Wanted to support you but unfortunately your Paypal link seems to be dysfunctional. Please update it.

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

    When I first watched one of your videos I was struck by how entertaining it was. But the more videos I watch, the more I notice how well I'm understanding the explanations in your videos.Thanks a lot for your amazing efforts!

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

      Thank you! :)

  • @becayebalde3820
    @becayebalde3820 ปีที่แล้ว +15

    I have now finished the 3 parts, ouf! Thank you a thousand times for the awesome content you provide 👏🏾

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

      BAM! There's one more part here: th-cam.com/video/Xm2C_gTAl8c/w-d-xo.html

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

    Lasso: Yee-ha! Ridge: Brrr... Elastic Net: ...

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

      Great Question!!! :) "snap"?

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

      Lol my favorite part of the video by far

  • @Paul-tl1du
    @Paul-tl1du 5 ปีที่แล้ว +16

    You have an uncanny way of explaining this material well. Thank you so much for creating these videos!

    • @statquest
      @statquest  5 ปีที่แล้ว

      Thank you! :)

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

    I can't say which is better, your albums or this amazing series.

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

      Thank you very much! :)

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

    Thank you so much Josh!! I was struggling with Lasso, Ridge, and ElasticNet Regression for my graduate class. Your 3 videos cleared up all the confusion. Thank you SO much for all that you do to make these topics accessible for all!

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

      Happy to help!

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

    The best explanations I could find online for Stats!!! Thank you Josh!

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

    Thank you very much Josh for explaining regularization so clearly ! The visuals that you use in your videos makes the learning easy.

    • @statquest
      @statquest  5 ปีที่แล้ว

      Hooray! Thank you. :)

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

    Thank you, Josh, for this excellent video on Elastic-Net Regression! It was a great finish to this 3-part series on Regularization!

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

    Thank you for the amazing videos! Your ability to explain the concepts simply is incomparable..!

    • @statquest
      @statquest  5 ปีที่แล้ว

      Thank you so much! :)

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

    Man that intro is the best it forces me to listen to the rest of the lecture. Thanks :)

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

    Hey Josh, thanks for the crisp explanation. Today after long procrastination, I managed to watch all three of the videos - L1, L2 and Elastic Net.

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

      Wow! Good work! :)

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

    I mean how easy can it get ... these views are the perfect example of how complex algorithms can be explained in simple and then later people can dive into the actual math behind it to get the full picture... Awesome ... thanks

    • @statquest
      @statquest  6 ปีที่แล้ว

      That's exactly the idea. I'm so glad you like the videos. :)

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

      @@statquest you're welcome and thank you for creating awesome videos..... i really enjoyed the pca ones... as first time i understood the svd in a simple way :-)

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

    At first, I came here for the stats revision. Lately, I've been finding myself visiting to remind myself of the tunes instead!

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

      That's awesome! :)

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

    Thanks Josh its 2022 and your videos saved me well!

  • @redpantherofmadrid
    @redpantherofmadrid 8 หลายเดือนก่อน +1

    you explain really well, better than the course I am following! thanks 🙏

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

      Thank you!

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

    OMG! I'm so happy I found your channel.

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

    Another great video!!! Keep it up!! Always big fan

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

      Triple bam! :)

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

    Sir! I really liked your style thank you for such entertainment and informative lecture🙏

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

      Thanks and welcome!

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

    Ihaaa!😀 All tutorials are brilliant! A huge thank you.

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

    Hi Josh, your lessons are so nice that I decided to support you. I bought your digita album "Made from TV". You rock!

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

      WOW!!!! Awesome! Thank you!

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

    man i love your way of teaching

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

    You explain the concepts so well ......Thanks a lot for these videos

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

      Thank you! :)

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

    Only reason I subscribed you is because of your singing before every videos! No doubt you explain very well

  • @SOLONASSYMEOU
    @SOLONASSYMEOU 7 หลายเดือนก่อน +1

    I sometimes come just for the intros! Amazing work!!!

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

      BAM! :)

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

    I love your channel man, its the major reason I'll be majoring in Data science in college!

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

      Thank you very much and good luck with your degree! :)

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

    You are awesome... I gonna buy a t-shirt with "I love StatQuest" written on it !

    • @statquest
      @statquest  5 ปีที่แล้ว

      Hooray!!! One day I'll have those shirts for sale.... One day.

  • @rezahay
    @rezahay 5 ปีที่แล้ว

    Wonderful, brilliant, awesome. What a relief! Finally, I understand some important concepts of the statistics. Thank you very much Josh.

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

    This clears things up a lot. 4 years on still the best explanation online. Yeeha

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

    I'm from Chile... i 've loved your videos of regularization, specially each intro!!!

    • @statquest
      @statquest  5 ปีที่แล้ว

      Hooray!!!! Thank you so much! :)

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

      @@statquest do you have any videos about SVM , Neural Net models?

    • @statquest
      @statquest  5 ปีที่แล้ว

      @@javiermenac Not yet, but I'm working on both. SVM will probably come first, followed by Neural Net.

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

    Your explanations are on point and easy to understand. (Can be used as quick reference) 🙆🏻👍🏻💯

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

    Wow, Ur channel is a boon to beginners like me in the world of Data Science.....Thanks a lot

  • @xiangnan-oz9hs
    @xiangnan-oz9hs 6 ปีที่แล้ว +1

    Thanks very much, StatQuest. each lecture is fantastic and interesting. Looking forward to your clearly explanation of Bayesian statistics, MCMC, MH, Gibbs sampling, etc.

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

      Glad you like the video! All of those topics are on the To-Do list, and hopefully I can get to them sooner than later. :)

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

    I like it a lot when he said the super fancy thing is actually xxx.

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

    You are the best! I indeed learned a lot from you! Thanks!

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

    whoa

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

    Love your clearly explained videos. And your songs are so sweet like Phoebe Buffay’s 😉

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

      Ha! Thanks. I sing the smelly song every day as a warm up. ;)

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

    I know answering these many comments is very boring
    I guess you using NLP to filter the comments and answer the important ones and auto reply the others
    Above video was wonderful! Thank You again Sir 😁

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

    Thanks for this amazing series! It is making my life way easier while I am taking Machine Learning course in university.
    Can you please 'clearly explain' what do you mean by correlated variables? And what Elastic Net regression does to them?

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

      An example of correlated variables is if I wanted to use "weight" and "height" measurements to predict something. Since small people tend to weight less than tall people, weight and height are correlated. Elastic-Net Regression would shrink the parameters associated with those variables together.

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

    In the intro song, I thought you would say "simpler.. than you might expect **it to be**" cause that rhymes. Anyways, love your videos. Thanks for doing such great work.

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

    really useful series, keep doing the great tutorials!

    • @statquest
      @statquest  5 ปีที่แล้ว

      Will do! I'm glad you like the videos. :)

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

    I love your channel!

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

      Thank you so much!

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

    Fantastic video Josh !! Thanks a lot, keep up the good work ! :)

    • @statquest
      @statquest  6 ปีที่แล้ว

      You're welcome! :)

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

    Thank you so much! Once again, your videos are of invaluable help to my PhD dissertation! And the "Brrr" made me laugh out loud :D

  • @georgfaustmann852
    @georgfaustmann852 5 ปีที่แล้ว

    Thanks for the entertaining and informative channel. Keep up the good work!

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

    The intro song with 2.0 speed is nice alternative to the original version :D

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

    POISSON REGRESSION, PARTIAL LEAST SQUARES AND PRINCIPAL COMPONENT REGRESSION PLEASEEE DR JOSHHH # WE LOVE YOU

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

    Thanks for all the Great Videos with decent musical intros! ;)
    I have a question concerning this one:
    You mention "lambdaX * variableX" but shouldn't it rather be "lambdaX * parameterX" (except the y intercept).

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

      You are exactly right.

  • @nguyenthituyetnhung1780
    @nguyenthituyetnhung1780 11 หลายเดือนก่อน +1

    excellent explanation for complexity of model 👍

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

      Thanks!

  • @sowmy525
    @sowmy525 5 ปีที่แล้ว +14

    Thank you StatQuest...awesome series :)
    Can you do videos on time series methods as well ...clearly explained :P

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

      You're welcome! I'll add time-series to the to-do list. The more people that ask for it, the more I'll move it up the list. :)

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

      @@statquest Thanks for the video lectures josh sir , I am also waiting for timeseries forecasting classes

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

      @@statquest it would be great if u do it

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

      @@saikumartadi8494 Your vote has been noted and I bumped time series up on the list. :)

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

      @@statquest awaiting for the video :)

  • @rsandeepnttf
    @rsandeepnttf 5 ปีที่แล้ว

    Crisp and clear ! thanks for the video

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

    I am in love with your videos Josh! BAM! I just wanted to ask when we have so many features and multicollinear variables (real case datasets), is applying Elastic Net Regression always better than Ridge and Lasso? I mean, we cannot actually check that as there are so many variables ( Your Deep Learning Example) so can we say that Elastic Net is best of both worlds? We can apply it in most of the scenarios where making a hypothesis about the features not very simple?

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

      I talk about this in my video that shows how to do Elastic Net regression in R. The answer is, "Yes, elastic-net gives you the best possible situation". See: th-cam.com/video/ctmNq7FgbvI/w-d-xo.html

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

      @@statquest Thank you so much!!! You are a savior!! BAMMMMM!!!

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

    Statquest staaaaat quest whaaat are we learning today....

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

      Looks like Elastic Net! :)

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

    I think you are missing parenthesis in penalty terms 3:31.
    But thank you so much for the videos!

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

    Thank you, your video is very useful

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

      Glad it was helpful!

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

    thanks for making elastic net this easy

    • @statquest
      @statquest  6 ปีที่แล้ว

      You're welcome!! :)

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

    Really nice videos! It's very well explained and helpful!
    Can you also do videos on adaptive elastic net and multi-step elastic net ? Thank you so much!

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

    Legendary as always! 😁🤘🤙👌👍

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

    Great! Thank-you Josh!

    • @statquest
      @statquest  6 ปีที่แล้ว

      You're welcome! :)

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

    Hey Josh another excellent video! I thank you very much! Quick question:
    Do you need brackets after the lambdas? ie
    λ1 Χ [variable1] + λ1 Χ [variable2] + ...
    or is it λ1 Χ { [variable1] + [variable2] + ... } ?
    and similarly for λ2 in ridge regression?

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

      The two ways you wrote out are equal to each other. So you can use one or the other, they are equivalent.

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

      @@statquest You 're right pff that was a mistake.
      I meant that you show this in 2:47:
      λ1 Χ [variable1] + ... + [variableX]
      And again with the squarred for Ridge. There must be a λ1 before the last bracket and λ2 for Ridge

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

      @@perrygogas Sorry! My notation is super sloppy here. There should be brackets around all of the variables. So it should be lambda1 * [ |v1| + |v2| + ...] + lambda2 * [ v1^2 + v2^2 + ...]

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

      @@statquest Great!!! thank you!!! you are the best!!!

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

    Hi Josh, great video! There's just one thing that I'm confused about. I understand that Elastic-Net is meant to provide the best of both worlds out of Lasso and Ridge regression but I'm struggling to get my head around what this means. You said that
    "Elastic-Net regression - groups and shrinks the parameters associated with the correlated variables and leaves them in the equation or removes them all at once".
    What's the advantage to keeping all of the correlated variables in the equation? I thought that this was a bad thing to do since they are likely providing the same information to the model more than once. Also, does Lasso always keep a single variable of a correlated variable group, even if the group doesn't actually help at all to make predictions?

    • @statquest
      @statquest  5 ปีที่แล้ว

      This is a great question, and there may be more than one good answer. However, here's my take on it. In a pure "machine learning" setting, retaining correlated variables my not be very useful, but in a research setting, it is very useful. If you have thousands of variables, it my be very useful to see which groups of variables are correlated because that could give you insight into your data that you didn't have before. Does that make sense?
      And if a variable or a group of correlated variables are not useful, then the corresponding coefficients will shrink, all of them.

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

      @@statquest Thanks for the quick answer. I can understand why this would be useful in a research setting but surely the purpose of regularization is to find the best set of parameter values to model the function? By holding onto these variables, I can only see them having a negative effect on the optimality of the model

    • @statquest
      @statquest  5 ปีที่แล้ว +6

      ​@@maskew So true! So I Iooked into this, and the answer is that correlated variables don't get in the way of predictions. They get in the way of trying to make sense of the effect of each variable on the prediction, but not in making the prediction itself. Said another way, if we used elastic-net regression and left a group of correlated variables in the model, we could conclude that they helped make good predictions, but we would not be able to make any conclusions about relationship between any one variable and the predicted response based on the coefficients. For more details, see point 5 on this page: newonlinecourses.science.psu.edu/stat501/node/346/

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

      @@statquest Right okay that makes sense then! Thanks a lot for getting back to me

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

    Thanks, I ended up googling that airspeed of a swallow thing and watching a Monty Python scene instead of learning how to do elastic net lol

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

    Thanks for the video Josh. Your explaination makes sense, but i can't wrap my head to think of a reason why would this work still. If we know some variables that are less important (e.g., Age in your previous example), don't we still have those variables that in the loss function? Is it just that their impact will be sitting in between none and when using L2?

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

      I'm not sure I understand your question. However, for less important variables, we can reduce their associated coefficients without drastically reducing the fit of the model to the data, and this will result in a significant reduction in the "penalty" that we add to the loss function.

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

    Notes:
    - The hybrid Elastic-Net Regression is especially good at dealing with situations when there are correlations between parameters.
    - Lasso Regression tends to pick just one of the correlated items and eliminates the others
    - Ridge Regression tends to shrink all the parameters for the correlated variables together
    - By combining Lasso and Ridge regression, Elastic-Net Regression groups and shrinks the parameters associated with the correlated variables and leaves them in equation or removes them all at once.

  • @엠제이-d7c
    @엠제이-d7c 3 ปีที่แล้ว

    Thanks so much for this video!! I have a quick question if I may. Didn't u mention in the last video that the lamda for ridge can be close to 0 but never equals 0? I was confused in the part where you say lamda 2 in the elastic-net regression can be 0 which makes it a lasso regression. Thank you in advance for your explanation. :)

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

      I think you confused lambda for the parameter estimates. With Ridge Regression, the parameter estimates can be close to 0, but not equal to 0. However, lambda can be any value >= 0, and the value is determined using cross-validation.

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

    Hey Josh! Thank you for this, watched your 4 regularization videos today and am happy! And a suggestion for a related, followup video - collinearity & multi-collinearity :)

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

      Thanks! I'll keep those topics in mind.

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

      @@statquest Thank YOU for all you do!

  • @龔冠宇-u9x
    @龔冠宇-u9x 3 ปีที่แล้ว +1

    Thanks a lot for your amazing videos. I just wondering, when I use Elastic Net, the coefficient of useless variable seems will not go to zero because of the part of the Ridge Regression in the equation. So, why not just use Losso Regression first to eliminate the useless variable and then use the Ridge Regression to regularize?

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

      Interesting. You could try that. However, in theory, elastic net is supposed to do that for you. So there may be some aspect specific to your data that is giving you strange results.

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

    Why do we not use parentheses after each lambda? I got confused as we did in the two earlier videos on regularization. Thanks for helping out!

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

      Oops. Looks like I forgot to add the parentheses. Sorry about the confusion that caused. :(

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

      ​@@statquest No worries! I thank you for your keeping my motivation level up there and getting back to me so quick.

  • @박세영-i8z
    @박세영-i8z 4 ปีที่แล้ว +1

    I have a question...
    I don't know what is the advantage of ridge regression.
    Ridge doesn't eliminate the trivial variables but lasso does.
    Then why we have to combinate them?
    I thought that ridge has a computational advantage because it doesn't use 'abstract'.
    But when we put them in together, so we use elastic-net algorithm, that advantage will disappear.
    Why we have to use elastic-net, not lasso?
    What is the advantage of keeping ridge's penalty term?

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

      This is a good question. It turns out that there are some technical issues with Lasso. To quote from the documentation:
      "It is known that the ridge penalty shrinks the coefficients of correlated predictors towards each other while the lasso tends to pick one of them and discard the others. The elastic-net penalty mixes these two; if predictors are correlated in groups, an α=0.5 tends to select the groups in or out together."
      You can read more here: web.stanford.edu/~hastie/glmnet/glmnet_alpha.html

    • @박세영-i8z
      @박세영-i8z 4 ปีที่แล้ว +1

      @@statquest wow, thank you very much!

  • @antoniovivaldi2270
    @antoniovivaldi2270 5 ปีที่แล้ว

    Your presentations are good - short, clear and well explained. However, the "lambda" parameters have to be arbitrarily chosen so the Lasso Regression and Ridge Regression methods lose objectivity - the result depends on the observer. I wonder where those methods are used. In my opinion, the classic Least Means Squares (LMS) or LMS with statistical weights (in different variations) are still the best methods/techniques for reduction of experimental data and modeling.

    • @statquest
      @statquest  5 ปีที่แล้ว

      Elastic Net is used all the time in Machine Learning and lambda is determined using cross validation.

    • @antoniovivaldi2270
      @antoniovivaldi2270 5 ปีที่แล้ว

      @@statquest Thank you! Would you kindly recommend a link to that "cross validation"?

    • @statquest
      @statquest  5 ปีที่แล้ว

      @@antoniovivaldi2270 Here's a link to the StatQuest on cross validation: th-cam.com/video/fSytzGwwBVw/w-d-xo.html

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

    Dear Josh, thank you so much for making life easier for us, if you believe in heaven you will be one the firsts in (lol). A question, how does the Lasso eliminate one of the correlated variables? lets say i have two identical variables v1 and v2 (with 100% correlation), how does the lasso work on them? thank you in advance

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

      Presumably, if you increase lambda enough, one parameter will go to 0.

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

    It doesn't gets more easier than this

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

    Hi Josh, Just revisited this video and very clearly explained. But what are the disadvantages of elastic net? Is this model more computational expensive?

    • @statquest
      @statquest  5 ปีที่แล้ว

      As far as I know, it's pretty efficient.

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

    Great video, thank you!! I'm just a bit unsure about the scaling of features. Say, if we scale a feature, what would change for lasso and ridge?

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

      Scaling the data will change the original least squares parameter estimates, but it will not change the process that Elastic-Net uses to reduce the influence of features that are less useful.

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

    Hi Josh, Thank you for another awesome video. I have one qn, how to decide which parameters to group for lasso and ridge penalty for Elastic net regression?? are they selected randomly? thanks in advance

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

      Elastic-net takes care of all of that for you. See it in action here: th-cam.com/video/ctmNq7FgbvI/w-d-xo.html

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

    Hi Josh, Thank you for the StatQuest. I am still slightly confused as how Elastic Net would improve the correlation between variables.
    I get that
    1) lasso regression would bring variable's weights or parameters to 0 if they are useless
    2) ridge regression would not be able to do that but can improve the parameter's influence on the graph more than lasso
    but I am still confused on the idea of correlation of variables for the lasso+ridge combination

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

      For more details, see: th-cam.com/video/ctmNq7FgbvI/w-d-xo.html

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

      @@statquest thanks for the answer :D, I was thinking of skipping this since it was coded in R and i don't know R but I will watch it :D

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

      @@shoto6018 You can ignore the details about R and focus on the results.

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

    What I dont understand: If the Lasso lambda is 0 > then all absolute variables will be multiplied by 0 and thus become zero >> then you could basically leave the Lasso lambda calculation out. So how come that you say it can really be zero, whereas the ridge lambda can only asymptotically touch 0. The lambda applies equally to all variables (except the y-intercept) right? So how can lasso get rid of "useless" variables?
    (excuse my english)

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

      Lambda is applied to all parameters (except for the intercept), but some parameters, when shrink them, the SSR does not increase very much (because that variable is not very useful) and other parameters, when we shrink them, the SSR goes up a lot (because that variable is useful), thus not all parameters are shrunk by the same amount, and that is why some go all the way to 0 and others do not.

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

    Hello @Josh Starmer,
    Thank you for your videos, so easy to understand.
    But we are talking about Elastic_net (also Ridge/Lasso) technical in Regression model.
    So how about others model? They can apply to solve overfitting situation as Regression!

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

      Yes. Ridge, Lasso and Elastic net style penalties can be added to all kinds of models.

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

      @@statquest all kinds of models with same formulars as Regression?

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

      @@tanphan3970 No, pretty much any formula will work. For example, regularization can be applied to Neural Networks, which are very different.

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

    So amazing, thank you!

    • @statquest
      @statquest  5 ปีที่แล้ว

      You're welcome! :)

  • @MohamedIbrahim-qk3tk
    @MohamedIbrahim-qk3tk 4 ปีที่แล้ว +1

    Lasso does the job of shrinking the coefficients AND removing the useless parameters right?

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

      In this video I show the roles that both Ridge and Lasso play in Elastic Net: th-cam.com/video/ctmNq7FgbvI/w-d-xo.html

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

    Sorry, mb its a bit silly, but.. Don't we need brackets after lambda1 for all absolute parameters and brackets after lambda2? 3:46 in the video

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

      Yes! You are correct. That was a slight omission. I hope it's not too confusion.

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

    Sir your videos are amazing. I have a question though. In case of deep neural networks why make the model complex and then add regularization or dropout, isn't a better idea not to create the problem at the first place that is not make the model complex? And if the the model is overfitting, shouldn't trying to reduce the complexity of the model be the solution?

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

      Neural Networks are a little bit like black boxes and it's hard to know what they are doing - so it's hard to know if the model is "simple" or "complex". So, with NNs, regularization can just deal with the overfitting problem without you having to worry too much about the model.

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

    Awesome explanation but i think you forgot the bracket in the equation for Lasso and Ridge Reg equation :)). The Lambda is supposed to multiply with the whole sum of squared slopes or absolute slopes.

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

      Yes, you are right. Sorry about that.

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

      @@statquest tks for your reply. I only realized it after taking notes

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

    Thanks for the clearly explanation, so since elastic regression is the best, should we just use elasitc regression every time instead of using lasso or ridge?

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

      Yes, because you can use Elastic Net to be pure Lasso or pure Ridge, and everything in between, so you can have it all.

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

    Hi Josh , i have doubt ... we usually remove the correlated variables while performing data cleaning , so why are we considering these correlated variables ??

    • @statquest
      @statquest  5 ปีที่แล้ว

      Good question! Yes, if you remove correlated variables in advance, then you don't need to do Lasso or Elastic-Net. However, with modern "deep learning" machine algorithms, there are too many variables (there could be millions) to clean by hand - so method like Lasso and Elastic-Net are very useful because they remove the correlated variables automatically.

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

      @@statquest ... Thanks a lot Josh for the prompt reply ... I love your songs at the start of every session and your explainatory skills are brilliant .. 😊✌️

    • @statquest
      @statquest  5 ปีที่แล้ว

      @@jyotimawri6772 Thank you so much! :)

  • @datascienceandmachinelearn3807
    @datascienceandmachinelearn3807 5 ปีที่แล้ว


    Thank you so much. I have learned alot and look forward to new videos. Good luck

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

    Hey Josh great video as usual ! I have a question for you, grateful if you can answer
    Let’s say I do a market mix modelling and I have closer to 250 variables and closer to 180 line items, which of these would be most suitable.
    Info about data
    A lot of these variables are super correlated, but I cannot afford to drop anyone off then since I need to present contribution of every channel to the business and they are naturally Co related since spending from business usually happens in clusters and are similar for similar channels like Facebook and Instagram.
    Any pointers on these will be very useful thanks!

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

      Try just using Ridge Regression and see how that works.

  • @Han-ve8uh
    @Han-ve8uh 3 ปีที่แล้ว

    1:12 says "Ridge works best when most variables in model are useful" I don't understand how would you know "most variables are useful" even before using Ridge, and how it can be used to select Lasso vs Ridge? Isn't the purpose of fitting a model to discover what is useful? Do you mean a Lasso is fit first to see which coefficients are non-zero to check usefulness, then subsequently fit Ridge in hopes that it will help on test set performance? What exactly is done first to ascertain that "most variables are useful"?
    Another thing i'm unsure when watching these regularization videos is whether the purpose (test set prediction performance vs studying coefficients) of the regression affects interpretations? Is a larger coefficient more useful? Or small coefficients on variables that give good test set prediction performance are useful?

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

      You don't know in advance if most of the variables are useful or not, but the good news is that Elastic-Net means we do not need to know. Elastic-Net automatically (through the process of applying cross validation to the different penalties) figures out how to best balance Ridge and Lasso regression penalties. For an example of this being done in practice, see: th-cam.com/video/ctmNq7FgbvI/w-d-xo.html
      Also, regularization does affect interpretation, and not in a good way. It is mostly used for predictions, rather than interpretations.

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

    brilliant !! but have a doubt in mind that how are we sure that elastic net regression would not cause high variance since its summing both ridge and lasso and due to this it will guide the model to change through a higher range?

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

      I'm not sure I understand your question, but, by using validation, we can test to see if elastic-net is increasing variance, and if so, not use it.

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

      @@statquest I meant was since the line tries to adjust to lowest error from the target as possible with the gradient descent and all .. but we use ridge and lasso regression that would slightly variance the line from the data (predicted points line to the actual data points line ) and the accuracy would be slightly increased or decreased depending on the data .. so if we use elastic net regression which is combination of both ridge and lasso it would cause higher variance and it's confirm that accuracy would be bit reduced right ?? This was the question

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

      here by variance i mean the distance between predict data points line and the actual data line

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

      @@mrcharm767 To be honest, I still don't understand your question. But I think part of the problem is that the term "variance" has two meanings - the statistical one ( th-cam.com/video/SzZ6GpcfoQY/w-d-xo.html ) - and the machine learning one ( th-cam.com/video/EuBBz3bI-aA/w-d-xo.html ). The whole point of regularization is to reduce variation in the sense of used in machine learning (and thus, increase long term accuracy) and we do that by desensitizing the model to the variables in the model. To see this in action, and to verify that it works correctly, see: th-cam.com/video/ctmNq7FgbvI/w-d-xo.html

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

      @@statquest yes u got right where i was actually i made a mistake interchanging bias and variance in the explanation

  • @조동민-f6o
    @조동민-f6o 5 ปีที่แล้ว +2

    I love this channel BAM~~~

  • @harsharavi8989
    @harsharavi8989 5 ปีที่แล้ว

    Hey Josh, I love your videos!!
    Lasso and elastic net regression also do work well when there are lesser data points compared to the variable, rite?

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

    Thanks a lot for your great videos.
    I don't understand why use Lasso reg or Ridge reg when we can use Elastic-Net reg?
    What is the draw back of Elastic Neg regression?

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

      None that I know of. However, not every ML method implements the full elastic net.

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

      @@statquest Thanks!
      I don't get why you don't get more thumbs up...
      Great show, thanks again

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

    nice explanation

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

    Awesome man .. Thanks a lot

    • @statquest
      @statquest  5 ปีที่แล้ว

      Thanks!!! :)

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

    Why would elastic net remove the parameters of correlated variables altogether or keep them and shrink them? I thought it’s a little bit of both.

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

    Thank you for your wonderful videos. It really helped me to understand ridge/lasso/elastic net. I still have one question though, it seems like elastic net regression can delete some variables even though both lambda 1 and 2 are not 0 (I found it from other papers). but I am not sure how that is possible if lambda 2 is not 0..... do you have any idea for this? Thanks again!

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

      As long as the lasso penalty is in use, then you can eliminate variables.

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

    hi josh!! am still unable to understand the advantage of elastic net regression..i can easily understand how ridge regression is advantageous compared to lasso..(i.e) instead of completely eliminating correlated features, it shrinks the parameters associated with those features..now plz tell how elasticnet is advantageous compared to using ridge regression alone!!

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

      I talk about that in this video: th-cam.com/video/ctmNq7FgbvI/w-d-xo.html

  • @JMRG2992
    @JMRG2992 5 ปีที่แล้ว

    I want to know something. Minimum sample size for ridge and lasso is?. I have checked tons of papers, where some journals use at least 4, and others use 30, and others requires to estimate (like Greenes) for about 250 observatoins. Would this change with ridge and lasso regressions?

  • @merrimac1
    @merrimac1 5 ปีที่แล้ว

    Thank you for the tutorial. One thing I don't get is why Elastic Net can remove some variables. It has the component of Ridge regression, so a variable won't be removed all together. How come?