I feel, steps for regression process can be like this: 1) split the data into train and test. 2) Use train data for cross-validation and find the parameter with min MSE. 3) Use the same parameter over test data and check for the accuracy of different models.
You are right, he has actually overfitted the data on test because the model was already trained with them. Spliting and then doing regularization is the correct way, but he probably dindnt wanna go into details here
You have already trained the model with whole data at first then splitting it for the prediction. Nothing wrong but I don't think so its an ideal technique.
@@danielwang977 no 1.What is the use of testing again(we shouldnot believe that accuracy), if the same dataset is already used in making the model. It is more of overfitting case. 2.dataset has tobe split first and then 1 has tobe trained, other has to be tested. I think 2 is better. We get to know how the model works for a foreign data. Imo
you all probably dont care but does anybody know a trick to get back into an Instagram account..? I somehow lost my account password. I would appreciate any tips you can give me!
I think the good example for regularization would be to show that model's accuracy on training data is excellent and accuracyon test data is bad i.e- overfitting; then we can use regularization and compare the results
Hi Krish, You are explained in a clear and easy manner to understand the concepts. Krish, If possible can you please explain the machine learning algorithms as like you explained as linear regression algorithm. I Mean to say, theoretical explanation of the all the important machine learning algorithms. thank you
I'm following the 'the complete machine learning playlist' playlist, but you're step-jumping skipping many details saying 'hope you know this', love your teaching though but Can you make any good completed playlist??
yes u said that right the explanation is good but it is difficult to follow the videos in step even after the playlist is available . some topics need to be rearranged and some need to be added in the playlist so that it becomes easy to follow the path ....but still its the best material available on youtube you can find all the topics but for that you need to search it manually on his channel
Why did we split the data into train & test "after" doing fitting in lasso regression? I mean, shouldn't it be like splitting the data before fitting and creating a model? 8:34
Is the method correct? In my understanding we should: 1. split up the data train and test.set (maybe - depends on data units - standardize before) 2. do the hyperparameter optimization on the train set with cv-> best model for training data 3. predict with best model on the test set -> realistic result for unseen data you did: 1. hyperparameter optimization on all data using cross validation -> best model for all data 2. split up all data in training and test set 3. predict with best model on test set -> in my opinion your "best model" has already seen the data in the test set. Hence the result should not be quit realistic. What do you think?
main aim of this video is to explain the ridge and lasso regression this small small things we can do it our self, so just do it your self instead of finding this silly type of mistake
Krish thank you for this video very informative. I have question though. Dont you think predicting (x_test, y_test) from the model that is trained from (x,y) would predict a memorized value? shouldn't it be accurate and realistic prediction if model is trained from x_train and y_train rather than x,y for testing purpose?
Hi. I just want to know if I am not wrong, we need to use train_test_split method before training the data. right? But you trained the data and then split the data into train & test, which for sure do not give us an accurate prediction on future predictions. Please correct me if I am wrong. Thank you.
Hi, he used cross validation first, which in itself does train-test split. cv=5 means splitting ino train-test 5 times and checking scoring(neg MSE) on each test set and showing mean value. So cross validation itself takes care of testing on unseen data. Doing a train-test split manually later on is an optional choice, hope this answer helps.
@@shashankkhare1023 I think it is better to split the data into train and test first and then go for cross validation using train data. Cross validation splits train data into train and validation.
The concept is well explained. However, as the ridge and lasso model is trained with the entire dataset and not x_train, data leakage has happened as the model is aware of the test inputs much before testing.
Thanks for your previous video Krish. I am not getting whether Lasso or Ridge is better at the end of the code. Also i referred a blog on this topic and found Elastic net is more efficient. Can you kindly explain this. Dy
Krish Just the video I wanted to see how ridge and lasso can be used in Python. Thanks a ton Can u pls explain what is the inference from last 2 dist plots...I didn't get
I have a question. what do you mean by stable in the last ses distplot graphs? both ridge and lasso looks same to me. how is one more stable than other
As u can watch at 4:10, he said that the more data closer to zero,the better the model u have.At histogram u can see that data is more fall in zero using Ridge that Lasso
Hi Krish, Amazing videos....On what basis Alpha parameter list is decided? Also can you please explain in more detail about the 2 plots in the last.? Thanks.
I had a doubt. what would happen if the best fit line has a slope 0 i.e parallel to the x axis. How would ridge and lasso regression help overcome overfitting in that case?
Hi Krish can you please explain why lasso is better than bridge in histogram prediction didn't able to follow the last minutes of the video.It would be great if you can clarify.
cross_validation not explained clearly. What it is? Why it's needed to perform linear_regression here and what are those hyperparameters e.g cv used under cross_val_score ?
HI Krish, At 5.58 time in video, you said that this best score helps us to find out which lambda value is suitable! but question that how? you have mentioned those values as an alpha values. and alpha values as a learning rate should not be very high number, instead it should be very small in order to reach global minima. regards, Krunal
Krish Naik thanks ! Could I also suggest a project for you to do ? Loan approval with online platform where you enter credentials of the client and it gives either to approve the loan or not . Is it just classification problem ?
Error i m getting: It seems like you're encountering an issue because the load_boston function has been removed from scikit-learn since version 1.2 due to ethical concerns related to the dataset.
your theory videos are good, but i don't like coding part it looks way different from what i do. you must have tried doing it from start with some new dataset. i'm good with theory but now i'm messing my mind with coding part(everyone has their own way of coding).
Thank you for sharing your knowledge. I have recently started watching and have learned a lot. I was just practicing the above code on Colab and it's giving me the following error: AttributeError: 'Series' object has no attribute 'prediction_lasso' on the line sns.distplot(y_test.prediction_lasso) and also at sns.distplot(y_test.prediction_ridge). Can anyone please help with how to fix this?
Watch the 2nd part just now.... You're like a savior to me as I have some deadlines due tomorrow and this helped me a lot sir. Thank you very much.💯💯
Thanks!
I feel, steps for regression process can be like this:
1) split the data into train and test.
2) Use train data for cross-validation and find the parameter with min MSE.
3) Use the same parameter over test data and check for the accuracy of different models.
You are right, he has actually overfitted the data on test because the model was already trained with them. Spliting and then doing regularization is the correct way, but he probably dindnt wanna go into details here
You have already trained the model with whole data at first then splitting it for the prediction. Nothing wrong but I don't think so its an ideal technique.
agreed
What would be a better technique? Obviously it's best to train with the whole data set right?
@@danielwang977 Test train split is the way to go. You can overfit the model if you train on the entire dataset.
@@danielwang977 no
1.What is the use of testing again(we shouldnot believe that accuracy), if the same dataset is already used in making the model. It is more of overfitting case.
2.dataset has tobe split first and then 1 has tobe trained, other has to be tested.
I think 2 is better. We get to know how the model works for a foreign data.
Imo
you all probably dont care but does anybody know a trick to get back into an Instagram account..?
I somehow lost my account password. I would appreciate any tips you can give me!
Beautifully explained. Really Helpful. Thank you!
I m d first to to watch ur video.. Was watching ur bias n variance video... N notification came for this... Big fan of urs sir...
Great explanation. Very nice and simple explanation for ridge and lasso. Both theoretical and practical concept is good. Keep doing such videos.
I think the good example for regularization would be to show that model's accuracy on training data is excellent and accuracyon test data is bad i.e- overfitting; then we can use regularization and compare the results
or use roc and auc xD
Hi Krish, You are explained in a clear and easy manner to understand the concepts. Krish, If possible can you please explain the machine learning algorithms as like you explained as linear regression algorithm. I Mean to say, theoretical explanation of the all the important machine learning algorithms. thank you
Excellent straightforward video :)
your videos are really nice keep it up!
I'm following the 'the complete machine learning playlist' playlist, but you're step-jumping skipping many details saying 'hope you know this', love your teaching though but Can you make any good completed playlist??
Agreed.. I'm also following the complete list.
yes u said that right the explanation is good but it is difficult to follow the videos in step even after the playlist is available . some topics need to be rearranged and some need to be added in the playlist so that it becomes easy to follow the path ....but still its the best material available on youtube you can find all the topics but for that you need to search it manually on his channel
A small suggestion --- better differentiate the terms - alpha (for Lassa) and lambda (for ridge). It is confusing.
Sir you are saviour
Tankk u soomuch... Sir❤
How do we select the value of Aplha/Lambda, what is the ideal value
Why did we split the data into train & test "after" doing fitting in lasso regression? I mean, shouldn't it be like splitting the data before fitting and creating a model? 8:34
Is the method correct?
In my understanding we should:
1. split up the data train and test.set (maybe - depends on data units - standardize before)
2. do the hyperparameter optimization on the train set with cv-> best model for training data
3. predict with best model on the test set -> realistic result for unseen data
you did:
1. hyperparameter optimization on all data using cross validation -> best model for all data
2. split up all data in training and test set
3. predict with best model on test set -> in my opinion your "best model" has already seen the data in the test set. Hence the result should not be quit realistic. What do you think?
true...was thinkinhg the same
main aim of this video is to explain the ridge and lasso regression this small small things we can do it our self, so just do it your self instead of finding this silly type of mistake
Superb explanation. Need to get my hands dirty in jupyter notebook. Thanks
Excellent !!
Krish thank you for this video very informative. I have question though. Dont you think predicting (x_test, y_test) from the model that is trained from (x,y) would predict a memorized value? shouldn't it be accurate and realistic prediction if model is trained from x_train and y_train rather than x,y for testing purpose?
Good videos. So far so good. From most of the videos, i feel inference part is missing. What can we infer from the plots ?
+1
can we use other scoring method rather than neg_mean_squared_error to solve the problem...If any please suggest...Please help me out..
Hi.
I just want to know if I am not wrong, we need to use train_test_split method before training the data. right?
But you trained the data and then split the data into train & test, which for sure do not give us an accurate prediction on future predictions.
Please correct me if I am wrong.
Thank you.
Hi, he used cross validation first, which in itself does train-test split. cv=5 means splitting ino train-test 5 times and checking scoring(neg MSE) on each test set and showing mean value. So cross validation itself takes care of testing on unseen data.
Doing a train-test split manually later on is an optional choice, hope this answer helps.
@@shashankkhare1023 I think it is better to split the data into train and test first and then go for cross validation using train data. Cross validation splits train data into train and validation.
is alpha is Lamba which we are trying to found out in ridge?
veryhelpful
The concept is well explained. However, as the ridge and lasso model is trained with the entire dataset and not x_train, data leakage has happened as the model is aware of the test inputs much before testing.
cross_val_score is the costfuntion as u send in the previous video
how to check which are the best variables left for the model
Is it necessary to use GridSearchCV for ridge and lasso regression?
Thanks for your previous video Krish. I am not getting whether Lasso or Ridge is better at the end of the code. Also i referred a blog on this topic and found Elastic net is more efficient. Can you kindly explain this.
Dy
Krish
Just the video I wanted to see how ridge and lasso can be used in Python. Thanks a ton
Can u pls explain what is the inference from last 2 dist plots...I didn't get
Hello krish ,
i am confused at the end which one is performed well ? Lasso or Ridge in this case?
Please give some feedback.
ridge performed well....closer to zero better perfromance
I have a question. what do you mean by stable in the last ses distplot graphs? both ridge and lasso looks same to me. how is one more stable than other
As u can watch at 4:10, he said that the more data closer to zero,the better the model u have.At histogram u can see that data is more fall in zero using Ridge that Lasso
Hello Krish, thanks for making this wonderful video. Could you also please make a video on SVM and its underlying aspects like Kernelization etc...
Sir after you made everything, I did not get things related to Cross Validation, can you please explain it in brief?
Hi Krish, Amazing videos....On what basis Alpha parameter list is decided? Also can you please explain in more detail about the 2 plots in the last.? Thanks.
Hi Krish, is there a reason you trained the whole data set before doing a train test split.
once we findout the best parameters do we use it ? where are we using it ?
thannks so much for the video !
Sir there is error like 'load_boston' has been removed from scikit-learn since version 1.2.
What should i do???
I had a doubt.
what would happen if the best fit line has a slope 0 i.e parallel to the x axis. How would ridge and lasso regression help overcome overfitting in that case?
but sir u have not scaled the values????
why im getting -1.34e+23 when i do mean_mse for linear reg??? is that bad?
Is deep learning playlist is complete ?if not please complete it🙏🙏
Hi Krish can you please explain why lasso is better than bridge in histogram prediction didn't able to follow the last minutes of the video.It would be great if you can clarify.
can someone please explain why are we subtracting y_test from prediction_ridge or prediction_lasso?
Please explain elastic regression aswell
cross_validation not explained clearly. What it is? Why it's needed to perform linear_regression here and what are those hyperparameters e.g cv used under cross_val_score ?
Thankyou sooooo much.. :)
Hi Krish. Nice video but not getting my histogram graph. it throws a value error. please help
HI Krish,
At 5.58 time in video, you said that this best score helps us to find out which lambda value is suitable! but question that how? you have mentioned those values as an alpha values. and alpha values as a learning rate should not be very high number, instead it should be very small in order to reach global minima.
regards,
Krunal
Hey we used alpha for ridge and lasso not linear regression.dont confuse learning rate(Alfa) with lambda.those alpha values is for lambda
Thats for gradient descents
I also got same issue. He is saying lamda is selected using cv then why he gave alpha values and printed best alpha value?
@@venkatasubbaraomandaleeka4973 he just typed lambda as alpha in the code for simplicity I guess..
I just don’t know where to start. By the way nice videos
wise guy you can do many things, for example code to drive your car while you are sleeping in the car :)
Just a small doubt Since I m new to data science,
You used cross_val technique for Linear Regress
ion but Grid Search for Ridge and Lasso ?
How can I find summary of date in ridge regression as like in OLS ( estimatr, standard error and p values ) ? Kindly help plZ
Use statmodels.GAM library
Can you tell me proper command?
@@Datacrunch777 explore statmodels library bro
Just curious but shouldn't we be standardizing our data when using linear regression? Or does sklearn automatically take care of that?
I guess it needs to be standardized before applying the algorithm
sir if i use cv=10 then the mse is coming still less..so how to chose the cv value appropriately..??will it depends upon the dataset..??
Cannot clone object. You should provide an instance of scikit-learn estimator instead of a class.
what is this error
Can you please make video on sentiment analysis on twitter
Krish, as always amazing video. But why you decide to use cv=5, and how you come up with alpha values ? thanks
U can choose any value for cv and alpha usually ranges between 0and 1
Krish Naik thanks ! Could I also suggest a project for you to do ? Loan approval with online platform where you enter credentials of the client and it gives either to approve the loan or not . Is it just classification problem ?
Error i m getting:
It seems like you're encountering an issue because the load_boston function has been removed from scikit-learn since version 1.2 due to ethical concerns related to the dataset.
me too, did you find any solution?
Hello Krish,
can you tell me how are you selecting alpha(lambda) values ?
The algorithm cycles through each of the parameters and uses cross validation to comprehensively test how accurate each parameter is.
Sir AirIndex Project Second Video?
Sir this mse =cross val
This line is showing error in my system sir... As per this 'neg_mean
This line is showing error...
Wat do I do sir?
Sir, will Ridge and Lasso Regression would always give us better result than linear regression or polynomial regression?
yes for sure
Now this dataset load_boston isnt available in sklearn instead I'm using california_hosing dataset
Are you able to achieve similar results with cali dataset?
your theory videos are good, but i don't like coding part it looks way different from what i do. you must have tried doing it from start with some new dataset. i'm good with theory but now i'm messing my mind with coding part(everyone has their own way of coding).
Sane
please provide code also sir, when practicing it will take more time to watch the video and type the code in editor.
it' s on his Github profile
refer the GitHub link in the description of this video
boston dataset has been depricated
Reply in insta
Thank you for sharing your knowledge. I have recently started watching and have learned a lot. I was just practicing the above code on Colab and it's giving me the following error: AttributeError: 'Series' object has no attribute 'prediction_lasso' on the line sns.distplot(y_test.prediction_lasso) and also at sns.distplot(y_test.prediction_ridge). Can anyone please help with how to fix this?