November 2017
Beginner
286 pages
8h 13m
English
There are a number of different functions and packages that implement ridge regression, such as lm.ridge() from the MASS package and ridge() from the genridge package. For the lasso, there is also the lars package. Here, in this chapter, we are going to use R's glmnet() function (from the glmnet package) due to it being well-documented and having a consistent and friendly interface.
The key to working with regularization is to determine an appropriate lambda value to use. The approach that the glmnet() function uses is to use a grid of different lambda values, training a regression model for each value. Then, one can either pick a value manually or use a technique to estimate the best lambda.
Read now
Unlock full access