I was working through the lab on ridge regression and LASSO in ISLR and I came across a strange behavior in the
cv.glmnet function. When I followed the lab as written I got the following
set.seed(1) train <- sample(1:nrow(x), nrow(x)/2) test <- (-train) y.test <- y[test] set.seed(1) cv.out <- cv.glmnet(x[train,], y[train], lambda=grid, alpha=0) plot(cv.out) bestlam <- cv.out$lambda.min bestlam  231.013
For my own benefit I tried it using a different seed (
8675309) and got back a different result. Any combination of setting the seeds resulted in different answers. I am assuming this has to do with how the 10-folds are changed with the different seeds, however the different
lambda.min can vary so much I am concerned the package might not be stable. Am I missing something?