Thanks, Spencer. Really great explanations. Would really appreciate it if you could do a video on "Group LASSO regression" for the "cox" family? (i.e. for time-to-event data)... There's absolutely no video of it out there.
Hmm. Maybe this paper might answer your question? www.researchgate.net/figure/The-algorithm-for-Cox-regression-with-group-lasso-penalty_fig2_263498791 Else, if there is enough interest for cox regression, I could perhaps research further.
Great video! I'm encountering some errors with my own data because of the presence of different levels of a categorical predictor in the train vs test dataset. In other words, I have a categorical predictor with different levels which I encoded as dummy variables. However because of the random 80/20 split, my test data does not contain some of the levels which are present in the train data, resulting in an error when using "predict". Do you have any tips on how to go about this? (also in case of z-scoring/ calculating standardized residuals in advance for some variables, I suppose scaling isn't necessary anymore for those variables?). Cheers!
I'd need more info. But, you might be running into a memory allocation issue. You can try to expand your machine by lessesning the restrictions on RAM via R. Else, you probably need a bigger machine or lessen the amount of data you are working with.
Hey, Spencer. Great video! For your data, i see that Ridge regression has a smaller value of MSE compared to Lasso. Doesn't that mean that Lasso is a little bit worse than Ridge regression in terms of MSE(though as you said it's not a big difference)?
Also, since they are a lot alike, if Lasso have reduced some coefs to 0, it its somewhat more desirable since we can drop variables on the model, right? Also, related question. Should you normalize before ridge/lasso?
1) Yes. If the coefficients for lasso reach 0, the algorithm will remove the feature. (One of the beauties of this regularization algorithm) 2) Yes. You should normalize your data prior to executing ridge/lasso
The features that are equal to 0 are cancelled out -- thereby leaving you with the remaining features in the dataset. So, now that we know what the primary purpose of Lasso Regression is, we must also know that Lasso Regression does not help you determine which features are "most important". You can infer what how effective the model is by doing post-selection inference. Meaning you would test individual features with different weights to see how well the outcome is in comparison with your test data.
When you're forecasting out of sample, you just need the model weights of your trained model. Your out of sample data should follow the same cleaning procedures as your in sample data. Then, you plug in the cleaned out of sample data into your model.
thanks =)
2:50 epic chewbacca sound
Thanks, Spencer
It was a great help.
Absolutely underrated channel
I'm glad you liked it :)) !
thanks spencer
Thanks, Spencer. Really great explanations.
Would really appreciate it if you could do a video on "Group LASSO regression" for the "cox" family? (i.e. for time-to-event data)... There's absolutely no video of it out there.
Hmm. Maybe this paper might answer your question?
www.researchgate.net/figure/The-algorithm-for-Cox-regression-with-group-lasso-penalty_fig2_263498791
Else, if there is enough interest for cox regression, I could perhaps research further.
Great video! I'm encountering some errors with my own data because of the presence of different levels of a categorical predictor in the train vs test dataset. In other words, I have a categorical predictor with different levels which I encoded as dummy variables. However because of the random 80/20 split, my test data does not contain some of the levels which are present in the train data, resulting in an error when using "predict". Do you have any tips on how to go about this? (also in case of z-scoring/ calculating standardized residuals in advance for some variables, I suppose scaling isn't necessary anymore for those variables?). Cheers!
thanks for the explanation, I am wondering if there is any other application with real data that has more features than observation?
Financial Data, Medical Data, Genomic data -- the list goes on.
Anyone knows why the R studio occurred "R Session Aborted and R encountered a fatal error" when I run this line of code???? "ridgeFit
I'd need more info. But, you might be running into a memory allocation issue. You can try to expand your machine by lessesning the restrictions on RAM via R. Else, you probably need a bigger machine or lessen the amount of data you are working with.
Hey, Spencer. Great video! For your data, i see that Ridge regression has a smaller value of MSE compared to Lasso. Doesn't that mean that Lasso is a little bit worse than Ridge regression in terms of MSE(though as you said it's not a big difference)?
yep!
Also, since they are a lot alike, if Lasso have reduced some coefs to 0, it its somewhat more desirable since we can drop variables on the model, right?
Also, related question. Should you normalize before ridge/lasso?
1) Yes. If the coefficients for lasso reach 0, the algorithm will remove the feature. (One of the beauties of this regularization algorithm)
2) Yes. You should normalize your data prior to executing ridge/lasso
@@SpencerPaoHere Thank you for answering and thank you for your awesome content Spencer :D.
From here how do you find which are the most important variables taken by the model or the coefficients from each variable?
The features that are equal to 0 are cancelled out -- thereby leaving you with the remaining features in the dataset. So, now that we know what the primary purpose of Lasso Regression is, we must also know that Lasso Regression does not help you determine which features are "most important".
You can infer what how effective the model is by doing post-selection inference. Meaning you would test individual features with different weights to see how well the outcome is in comparison with your test data.
Hi i need help i need a application with R for a lasso régression
What’s the issue ?
Hi i want to change the lasso constraint how can i do without ready code
Are you talking about the lambda value?
And, what do you mean without ready code? As in do it from scratch?
So when you predict the lasso model, you obtain the fitted values. But how does it work when you forecast out of sample?
When you're forecasting out of sample, you just need the model weights of your trained model. Your out of sample data should follow the same cleaning procedures as your in sample data. Then, you plug in the cleaned out of sample data into your model.
@@SpencerPaoHere Ok thanks. When you say model weights, do you mean the beta coefficients of the lasso regression?
@@TheNiko7980 Yes.
@@SpencerPaoHere Okay, nice. You’re a lifesaver! How would that look like in R?
@@TheNiko7980 Something like:
predict(model, cleaned-out-of-sample-input)