# NOT RUN {
library(glmnet)
data(diamonds, package='ggplot2')
diaX <- useful::build.x(price ~ carat + cut + x - 1, data=diamonds, contrasts = TRUE)
diaY <- useful::build.y(price ~ carat + cut + x - 1, data=diamonds)
modG1 <- glmnet(x=diaX, y=diaY)
extractPath(modG1)
modG2 <- cv.glmnet(x=diaX, y=diaY, nfolds=5)
extractPath(modG2)
# }
Run the code above in your browser using DataLab