- Day 6: Model Selection II
Lucas Leemann
Essex Summer School
Introduction to Statistical Learning
- L. Leemann (Essex Summer School)
Day 6 Introduction to SL 1 / 26
Day 6: Model Selection II Lucas Leemann Essex Summer School - - PowerPoint PPT Presentation
Day 6: Model Selection II Lucas Leemann Essex Summer School Introduction to Statistical Learning L. Leemann (Essex Summer School) Day 6 Introduction to SL 1 / 26 1 Repetition Week 1 2 Regularization Approaches Ridge
Day 6 Introduction to SL 1 / 26
Day 6 Introduction to SL 2 / 26
Red: Test error. Blue: Training error. (Hastie et al, 2008: 220)
Day 6 Introduction to SL 3 / 26
1 2
1 2 3 X Y
α
ΔX ΔY β=(ΔY)/ΔX) Yi=2.45 Y ^i=1.85 u ^i=0.6
Day 6 Introduction to SL 4 / 26
(James et al, 2013: 140)
Day 6 Introduction to SL 5 / 26
(James et al, 2013: 181)
Day 6 Introduction to SL 6 / 26
Day 6 Introduction to SL 7 / 26
Day 6 Introduction to SL 8 / 26
Day 6 Introduction to SL 9 / 26
Day 6 Introduction to SL 10 / 26
Day 6 Introduction to SL 11 / 26
1e−02 1e+00 1e+02 1e+04 −300 −100 100 200 300 400
Standardized Coefficients Income Limit Rating Student
0.0 0.2 0.4 0.6 0.8 1.0 −300 −100 100 200 300 400
Standardized Coefficients
λ k2/kˆ
|| ˆ β||2 =
j=1 β2 j
(James et al, 2013: 216)
Day 6 Introduction to SL 12 / 26
j=1 |—j|
j=1 —2 j
Day 6 Introduction to SL 13 / 26
Day 6 Introduction to SL 14 / 26
1e−01 1e+01 1e+03 10 20 30 40 50 60
Mean Squared Error
0.0 0.2 0.4 0.6 0.8 1.0 10 20 30 40 50 60
Mean Squared Error
λ kˆ βR
λ k2/kˆ
βk2 (James et al, 2013: 218)
Day 6 Introduction to SL 15 / 26
Day 6 Introduction to SL 16 / 26
Day 6 Introduction to SL 17 / 26
20 50 100 200 500 2000 5000 −200 100 200 300 400
Standardized Coefficients
0.0 0.2 0.4 0.6 0.8 1.0 −300 −100 100 200 300 400
Standardized Coefficients Income Limit Rating Student
λ k1/kˆ
(James et al, 2013: 220)
Day 6 Introduction to SL 18 / 26
5 10 15 20
50 Log Lambda Coefficients 19 18 2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
5 10 15 20 100000 200000 log(Lambda) Mean-Squared Error 19 19 17 17 18 17 9 7 5 4 1
Day 6 Introduction to SL 19 / 26
> lasso.pred <- predict(lasso.mod, s = log(cv.out$lambda.1se), newx = x[test, ]) > plot(lasso.pred, y[test], ylim=c(0,2500), xlim=c(0,2500), ylab="True Value in Test Data", xlab="Predicted Value in Test Data") > abline(coef = c(0,1),lty=2)
500 1000 1500 2000 2500 500 1000 1500 2000 2500 Predicted Value in Test Data True Value in Test Data
Day 6 Introduction to SL 20 / 26
0.02 0.10 0.50 2.00 10.00 50.00 10 20 30 40 50 60
Mean Squared Error
0.0 0.2 0.4 0.6 0.8 1.0 10 20 30 40 50 60
R2 on Training Data Mean Squared Error
λ
Day 6 Introduction to SL 21 / 26
0.02 0.10 0.50 2.00 10.00 50.00 20 40 60 80 100
Mean Squared Error
0.4 0.5 0.6 0.7 0.8 0.9 1.0 20 40 60 80 100
R2 on Training Data Mean Squared Error
λ
Day 6 Introduction to SL 22 / 26
Day 6 Introduction to SL 23 / 26
Day 6 Introduction to SL 24 / 26
Day 6 Introduction to SL 25 / 26
Day 6 Introduction to SL 26 / 26