This week we will talk about shrinkage and hyperparameter tuning.
We will use the Hitters
data set from the ISLR
library. It can be loaded using the following code
Remove all rows where the salary is NA
and split the data into testing and training data sets.
linear_reg()
with mixture = 0
to specify a ridge regression model.