SlideShare a Scribd company logo
1 of 22
林子軒
Lasso
演化史&比較
 Ridge Regression
比較
 更容易分別出重要變數,相較於ridge,
可讓beta較容易為0
Poisson by MLE
USE MLE
為何選用
 簡單,相較於LDA or QDA
 以上都是做線性轉換,必須要有所有變數
 Lasso是一種降維方法,減少變數收集
優點
 可以找到重要變數,減少成本
 例如:醫院
觸診,X光,超音波,電腦斷層,核磁共振
 Normal 快速,相較於其他分配
 loss function可自由改變,不限於MSE
其他 Loss function
 讓data集中
其他 Loss function
 錯誤權重相同
注意
 變數需要先標準化,減少bias ,因為我們是比較beta
大小
 懲罰項沒有常數項beta_0
Lassso+Ridge Regression
 glmnet packages
Lassso+Ridge Regression
 可以用於建model
 model = glmnet(as.matrix(x) , y
 ,family = c("poisson")
 ,alpha = 0.005
 ,nlambda = 5 )
 predict(model, s=0, as.matrix(x), type="response")
程式 and 模擬
 #生成 data
 n=10000
 x1=rnorm(n,5,1)
 x2=rnorm(n,10,2)
 x3=rnorm(n,15,3)
 x4=rnorm(n,20,4)
 x5=rnorm(n,25,5)
 x6=rnorm(n,30,6)
 x7=rnorm(n,35,7)
 x8=rnorm(n,40,8)
 y= 20*x1+10*x2+0.1*x3+10*x4+0.1*x5 + rnorm(n,0,1)
程式 and 模擬
 x=matrix(c( x1,x2,x3,x4,x5,x6,x7,x8 ),ncol=8)
 gt <- cv.glmnet(x, y)
 gt.coef <- coef(gt$glmnet.fit, s = gt$lambda.1se)
 plot(gt)
程式 and 模擬
程式 and 模擬
 數值方法
 找到最好的lambda ->
 估計beta
↓
注意
 glmnet 做 predict ,因為bias
會有 高估 or 低估 的傾向,需要乘上一個常數
實例
 利用lasso進行建 model and predict (*0.985)
 Kaggle N0.1201
 再加上 machine learning
 Kaggle N0.398
 two model 合併
 Kaggle N0.315
END

More Related Content

Viewers also liked

Multicollinearity1
Multicollinearity1Multicollinearity1
Multicollinearity1Muhammad Ali
 
Multicolinearity
MulticolinearityMulticolinearity
MulticolinearityPawan Kawan
 
Ridge regression, lasso and elastic net
Ridge regression, lasso and elastic netRidge regression, lasso and elastic net
Ridge regression, lasso and elastic netVivian S. Zhang
 
Apprentissage automatique, Régression Ridge et LASSO
Apprentissage automatique, Régression Ridge et LASSOApprentissage automatique, Régression Ridge et LASSO
Apprentissage automatique, Régression Ridge et LASSOPierre-Hugues Carmichael
 
Slideshare.Com Powerpoint
Slideshare.Com PowerpointSlideshare.Com Powerpoint
Slideshare.Com Powerpointguested929b
 
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic NetsData Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic NetsDerek Kane
 
Slideshare Powerpoint presentation
Slideshare Powerpoint presentationSlideshare Powerpoint presentation
Slideshare Powerpoint presentationelliehood
 

Viewers also liked (13)

C2.5
C2.5C2.5
C2.5
 
Ridge regression
Ridge regressionRidge regression
Ridge regression
 
Poisson regression models for count data
Poisson regression models for count dataPoisson regression models for count data
Poisson regression models for count data
 
Diagnostic in poisson regression models
Diagnostic in poisson regression modelsDiagnostic in poisson regression models
Diagnostic in poisson regression models
 
Lasso regression
Lasso regressionLasso regression
Lasso regression
 
Multicollinearity1
Multicollinearity1Multicollinearity1
Multicollinearity1
 
Multicolinearity
MulticolinearityMulticolinearity
Multicolinearity
 
Module1
Module1Module1
Module1
 
Ridge regression, lasso and elastic net
Ridge regression, lasso and elastic netRidge regression, lasso and elastic net
Ridge regression, lasso and elastic net
 
Apprentissage automatique, Régression Ridge et LASSO
Apprentissage automatique, Régression Ridge et LASSOApprentissage automatique, Régression Ridge et LASSO
Apprentissage automatique, Régression Ridge et LASSO
 
Slideshare.Com Powerpoint
Slideshare.Com PowerpointSlideshare.Com Powerpoint
Slideshare.Com Powerpoint
 
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic NetsData Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
 
Slideshare Powerpoint presentation
Slideshare Powerpoint presentationSlideshare Powerpoint presentation
Slideshare Powerpoint presentation
 

Lasso