SlideShare a Scribd company logo
1 of 9
The equation of a straight line is
 b = value of y when x=0 (intercept)
 m = Slope or Gradient (how steep the line is)
Reference: https://www.mathsisfun.com/equation_of_line.html
Linear regression is an approach to model the relationship between a dependent variable and one
or more independent variables.
 Linear Regression model try to create a linear
relationship between dependent (salary) and
independent (experience) variables.
 It try to create the equation of a straight line (salary =
m * experience + b) with minimum error (residual)
between actual value and predicted value.
 Equation for simple linear regression : y = m*x + b
 Equation for multiple linear regression : y = m1*x1 + m2*x2 + …. + mn*xn + b
Linear Regression tries to create best fit line with minimum
sum of residuals (∑ ( Y – Ypredict )^2) which is also known as
cost function.
Slope = 1
Intercept = 0
Slope = 0
Intercept = 0
Slope =
Undefined (1/0)
 In case of the lines having higher slope, any
minor variation in x can cause to a major
variation in y.
 In the linear regression model creating with
such data can have overfitting problem.
 One solution is to penalize the slopes and
make the model a generalized one.
 LASSO and RIDGE regression are models will
help for the same.
Underfitting occurs when a model can’t accurately
capture the dependencies among data, usually as a
consequence of its own simplicity. It often yields a
with known data and bad generalization
applied with new data.
Overfitting happens when a model learns both
dependencies among data and random
words, a model learns the existing data too well.
models usually yield high 𝑅². However, they often
generalize well and have significantly lower 𝑅²
with new data.
A good way to reduce overfitting is to regularize the model (i.e.,
to constrain it):
For a linear model, regularization is typically achieved by
constraining the weights of the model. Why?
The size of coefficients increase exponentially with increase in model
complexity
Techniques like Ridge Regression, Lasso Regression, and
Elastic Net, implement three different ways to constrain the
weights.
Least Absolute Shrinkage and Selection
Operator Regression (simply called Lasso
Regression) is another regularized version of
Linear Regression: that adds a L1
regularization term to the cost function,
The minimization objectives is MSE +  * | m |
Default value of alpha is 1. It can be zero to any positive
number.
Lasso Regression tends to completely
eliminate the weights of the least important
features (i.e., set them to zero).
Ridge Regression (also called Tikhonov
regularization) is a L2 regularized version of Linear
Regression: a regularization term equal to  *
slope^2 is added to the cost function.
The minimization objectives is MSE +  * m^2
This forces the learning algorithm to not only fit
the data but also keep the model weights as small
as possible.
Note that the regularization term should only be
added to the cost function during training.
The  (alpha) balance the amount of emphasis to the
regularization. Default value of alpha is 1. It can be
zero to any positive number.
 = 0  simple linear regression
 =   all coefficients become zero
increasing α leads to flatter (i.e., less extreme,
more reasonable) predictions.
Elastic net is a popular type of regularized linear regression that combines
two popular penalties, specifically the L1 and L2 penalty functions.
Similar to Ridge and LASSO Elastic Net is an extension of linear regression,
this adds regularization penalties to the loss function during training.
The penalty is a mixture of L1 and L2 penalties. Alpha and l1_ratio arguments
decides the same. Default value of alpha is 1 and can be passed according to
convenience of the data.
l1_ratio can have value from 0 to 1. Default value =0.5. l1_ratio = 0 means the
penalty is an L2 penalty. l1_ratio = 1 means it is an L1 penalty. l1_ratio is
between 0 and 1, the penalty is a combination of L1 and L2.
Reference: https://machinelearningmastery.com/elastic-net-regression-in-python/
Lasso and ridge regression

More Related Content

What's hot

Machine Learning - Simple Linear Regression
Machine Learning - Simple Linear RegressionMachine Learning - Simple Linear Regression
Machine Learning - Simple Linear RegressionSiddharth Shrivastava
 
Machine Learning-Linear regression
Machine Learning-Linear regressionMachine Learning-Linear regression
Machine Learning-Linear regressionkishanthkumaar
 
Introduction to Linear Discriminant Analysis
Introduction to Linear Discriminant AnalysisIntroduction to Linear Discriminant Analysis
Introduction to Linear Discriminant AnalysisJaclyn Kokx
 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionDrZahid Khan
 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionsaba khan
 
Polynomial regression
Polynomial regressionPolynomial regression
Polynomial regressionnaveedaliabad
 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionDrZahid Khan
 
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...Edureka!
 
Linear models and multiclass classification
Linear models and multiclass classificationLinear models and multiclass classification
Linear models and multiclass classificationNdSv94
 
Ensemble methods in machine learning
Ensemble methods in machine learningEnsemble methods in machine learning
Ensemble methods in machine learningSANTHOSH RAJA M G
 
Decision Trees
Decision TreesDecision Trees
Decision TreesStudent
 
Machine Learning With Logistic Regression
Machine Learning  With Logistic RegressionMachine Learning  With Logistic Regression
Machine Learning With Logistic RegressionKnoldus Inc.
 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionVARUN KUMAR
 
ML - Multiple Linear Regression
ML - Multiple Linear RegressionML - Multiple Linear Regression
ML - Multiple Linear RegressionAndrew Ferlitsch
 
What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?Kazuki Yoshida
 
Overfitting & Underfitting
Overfitting & UnderfittingOverfitting & Underfitting
Overfitting & UnderfittingSOUMIT KAR
 

What's hot (20)

Support Vector Machines ( SVM )
Support Vector Machines ( SVM ) Support Vector Machines ( SVM )
Support Vector Machines ( SVM )
 
Machine Learning - Simple Linear Regression
Machine Learning - Simple Linear RegressionMachine Learning - Simple Linear Regression
Machine Learning - Simple Linear Regression
 
Machine Learning-Linear regression
Machine Learning-Linear regressionMachine Learning-Linear regression
Machine Learning-Linear regression
 
Introduction to Linear Discriminant Analysis
Introduction to Linear Discriminant AnalysisIntroduction to Linear Discriminant Analysis
Introduction to Linear Discriminant Analysis
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
 
Polynomial regression
Polynomial regressionPolynomial regression
Polynomial regression
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
 
Linear regression theory
Linear regression theoryLinear regression theory
Linear regression theory
 
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
 
Linear models and multiclass classification
Linear models and multiclass classificationLinear models and multiclass classification
Linear models and multiclass classification
 
Ensemble methods in machine learning
Ensemble methods in machine learningEnsemble methods in machine learning
Ensemble methods in machine learning
 
Decision Trees
Decision TreesDecision Trees
Decision Trees
 
Logistic Regression Analysis
Logistic Regression AnalysisLogistic Regression Analysis
Logistic Regression Analysis
 
Machine Learning With Logistic Regression
Machine Learning  With Logistic RegressionMachine Learning  With Logistic Regression
Machine Learning With Logistic Regression
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent method
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
 
ML - Multiple Linear Regression
ML - Multiple Linear RegressionML - Multiple Linear Regression
ML - Multiple Linear Regression
 
What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?
 
Overfitting & Underfitting
Overfitting & UnderfittingOverfitting & Underfitting
Overfitting & Underfitting
 

Similar to Lasso and ridge regression

Machine learning session4(linear regression)
Machine learning   session4(linear regression)Machine learning   session4(linear regression)
Machine learning session4(linear regression)Abhimanyu Dwivedi
 
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai UniversityMadhav Mishra
 
Regression analysis and its type
Regression analysis and its typeRegression analysis and its type
Regression analysis and its typeEkta Bafna
 
Machine Learning Interview Question and Answer
Machine Learning Interview Question and AnswerMachine Learning Interview Question and Answer
Machine Learning Interview Question and AnswerLearnbay Datascience
 
NPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docxNPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docxMr. Moms
 
Gradient Decent in Linear Regression.pptx
Gradient Decent in Linear Regression.pptxGradient Decent in Linear Regression.pptx
Gradient Decent in Linear Regression.pptxalphaomega55
 
Bootcamp of new world to taken seriously
Bootcamp of new world to taken seriouslyBootcamp of new world to taken seriously
Bootcamp of new world to taken seriouslykhaled125087
 
Linear regression.pptx
Linear regression.pptxLinear regression.pptx
Linear regression.pptxssuserb8a904
 
Supervised Learning.pdf
Supervised Learning.pdfSupervised Learning.pdf
Supervised Learning.pdfgadissaassefa
 
Regression Analysis.pptx
Regression Analysis.pptxRegression Analysis.pptx
Regression Analysis.pptxarsh260174
 
Regression Analysis Techniques.pptx
Regression Analysis Techniques.pptxRegression Analysis Techniques.pptx
Regression Analysis Techniques.pptxYutaItadori
 
Statistical computing with r estatistica - maria l. rizzo
Statistical computing with r   estatistica - maria l. rizzoStatistical computing with r   estatistica - maria l. rizzo
Statistical computing with r estatistica - maria l. rizzoAndré Oliveira Souza
 
Linear logisticregression
Linear logisticregressionLinear logisticregression
Linear logisticregressionkongara
 

Similar to Lasso and ridge regression (20)

MF Presentation.pptx
MF Presentation.pptxMF Presentation.pptx
MF Presentation.pptx
 
Machine learning session4(linear regression)
Machine learning   session4(linear regression)Machine learning   session4(linear regression)
Machine learning session4(linear regression)
 
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
 
Linear Regression
Linear RegressionLinear Regression
Linear Regression
 
Regression ppt.pptx
Regression ppt.pptxRegression ppt.pptx
Regression ppt.pptx
 
Regression analysis and its type
Regression analysis and its typeRegression analysis and its type
Regression analysis and its type
 
Machine Learning Interview Question and Answer
Machine Learning Interview Question and AnswerMachine Learning Interview Question and Answer
Machine Learning Interview Question and Answer
 
NPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docxNPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docx
 
Gradient Decent in Linear Regression.pptx
Gradient Decent in Linear Regression.pptxGradient Decent in Linear Regression.pptx
Gradient Decent in Linear Regression.pptx
 
Bootcamp of new world to taken seriously
Bootcamp of new world to taken seriouslyBootcamp of new world to taken seriously
Bootcamp of new world to taken seriously
 
Linear regression.pptx
Linear regression.pptxLinear regression.pptx
Linear regression.pptx
 
Supervised Learning.pdf
Supervised Learning.pdfSupervised Learning.pdf
Supervised Learning.pdf
 
Ai saturdays presentation
Ai saturdays presentationAi saturdays presentation
Ai saturdays presentation
 
Regression Analysis.pptx
Regression Analysis.pptxRegression Analysis.pptx
Regression Analysis.pptx
 
Regression Analysis Techniques.pptx
Regression Analysis Techniques.pptxRegression Analysis Techniques.pptx
Regression Analysis Techniques.pptx
 
working with python
working with pythonworking with python
working with python
 
Statistical computing with r estatistica - maria l. rizzo
Statistical computing with r   estatistica - maria l. rizzoStatistical computing with r   estatistica - maria l. rizzo
Statistical computing with r estatistica - maria l. rizzo
 
Linear logisticregression
Linear logisticregressionLinear logisticregression
Linear logisticregression
 
7 regularization
7 regularization7 regularization
7 regularization
 
Unit 03 - Consolidated.pptx
Unit 03 - Consolidated.pptxUnit 03 - Consolidated.pptx
Unit 03 - Consolidated.pptx
 

More from SreerajVA

Logistic regression classification
Logistic regression classificationLogistic regression classification
Logistic regression classificationSreerajVA
 
Linear regression
Linear regressionLinear regression
Linear regressionSreerajVA
 
KNN, SVM, Naive bayes classifiers
KNN, SVM, Naive bayes classifiersKNN, SVM, Naive bayes classifiers
KNN, SVM, Naive bayes classifiersSreerajVA
 
Decision tree random forest classifier
Decision tree random forest classifierDecision tree random forest classifier
Decision tree random forest classifierSreerajVA
 
KMeans clustering
KMeans clusteringKMeans clustering
KMeans clusteringSreerajVA
 
ADABoost classifier
ADABoost classifierADABoost classifier
ADABoost classifierSreerajVA
 

More from SreerajVA (6)

Logistic regression classification
Logistic regression classificationLogistic regression classification
Logistic regression classification
 
Linear regression
Linear regressionLinear regression
Linear regression
 
KNN, SVM, Naive bayes classifiers
KNN, SVM, Naive bayes classifiersKNN, SVM, Naive bayes classifiers
KNN, SVM, Naive bayes classifiers
 
Decision tree random forest classifier
Decision tree random forest classifierDecision tree random forest classifier
Decision tree random forest classifier
 
KMeans clustering
KMeans clusteringKMeans clustering
KMeans clustering
 
ADABoost classifier
ADABoost classifierADABoost classifier
ADABoost classifier
 

Recently uploaded

VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
Data-Analysis for Chicago Crime Data 2023
Data-Analysis for Chicago Crime Data  2023Data-Analysis for Chicago Crime Data  2023
Data-Analysis for Chicago Crime Data 2023ymrp368
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Delhi Call girls
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一ffjhghh
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改atducpo
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 

Recently uploaded (20)

VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
 
Data-Analysis for Chicago Crime Data 2023
Data-Analysis for Chicago Crime Data  2023Data-Analysis for Chicago Crime Data  2023
Data-Analysis for Chicago Crime Data 2023
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 

Lasso and ridge regression

  • 1.
  • 2. The equation of a straight line is  b = value of y when x=0 (intercept)  m = Slope or Gradient (how steep the line is) Reference: https://www.mathsisfun.com/equation_of_line.html
  • 3. Linear regression is an approach to model the relationship between a dependent variable and one or more independent variables.  Linear Regression model try to create a linear relationship between dependent (salary) and independent (experience) variables.  It try to create the equation of a straight line (salary = m * experience + b) with minimum error (residual) between actual value and predicted value.  Equation for simple linear regression : y = m*x + b  Equation for multiple linear regression : y = m1*x1 + m2*x2 + …. + mn*xn + b Linear Regression tries to create best fit line with minimum sum of residuals (∑ ( Y – Ypredict )^2) which is also known as cost function.
  • 4. Slope = 1 Intercept = 0 Slope = 0 Intercept = 0 Slope = Undefined (1/0)  In case of the lines having higher slope, any minor variation in x can cause to a major variation in y.  In the linear regression model creating with such data can have overfitting problem.  One solution is to penalize the slopes and make the model a generalized one.  LASSO and RIDGE regression are models will help for the same. Underfitting occurs when a model can’t accurately capture the dependencies among data, usually as a consequence of its own simplicity. It often yields a with known data and bad generalization applied with new data. Overfitting happens when a model learns both dependencies among data and random words, a model learns the existing data too well. models usually yield high 𝑅². However, they often generalize well and have significantly lower 𝑅² with new data.
  • 5. A good way to reduce overfitting is to regularize the model (i.e., to constrain it): For a linear model, regularization is typically achieved by constraining the weights of the model. Why? The size of coefficients increase exponentially with increase in model complexity Techniques like Ridge Regression, Lasso Regression, and Elastic Net, implement three different ways to constrain the weights.
  • 6. Least Absolute Shrinkage and Selection Operator Regression (simply called Lasso Regression) is another regularized version of Linear Regression: that adds a L1 regularization term to the cost function, The minimization objectives is MSE +  * | m | Default value of alpha is 1. It can be zero to any positive number. Lasso Regression tends to completely eliminate the weights of the least important features (i.e., set them to zero).
  • 7. Ridge Regression (also called Tikhonov regularization) is a L2 regularized version of Linear Regression: a regularization term equal to  * slope^2 is added to the cost function. The minimization objectives is MSE +  * m^2 This forces the learning algorithm to not only fit the data but also keep the model weights as small as possible. Note that the regularization term should only be added to the cost function during training. The  (alpha) balance the amount of emphasis to the regularization. Default value of alpha is 1. It can be zero to any positive number.  = 0  simple linear regression  =   all coefficients become zero increasing α leads to flatter (i.e., less extreme, more reasonable) predictions.
  • 8. Elastic net is a popular type of regularized linear regression that combines two popular penalties, specifically the L1 and L2 penalty functions. Similar to Ridge and LASSO Elastic Net is an extension of linear regression, this adds regularization penalties to the loss function during training. The penalty is a mixture of L1 and L2 penalties. Alpha and l1_ratio arguments decides the same. Default value of alpha is 1 and can be passed according to convenience of the data. l1_ratio can have value from 0 to 1. Default value =0.5. l1_ratio = 0 means the penalty is an L2 penalty. l1_ratio = 1 means it is an L1 penalty. l1_ratio is between 0 and 1, the penalty is a combination of L1 and L2. Reference: https://machinelearningmastery.com/elastic-net-regression-in-python/