Explicit Coefficient Penalization
 Explicit Coefficient Penalization Of course, the value of the  regularization parameter λ needs to be optimized. A function cv.glmnet is  available for that, using by default ten-fold crossvalidation. Two common  measures are available as predefined choices. Obviously, the model corresponding  to the lowest crossvalidation error is one of them; the other is the most sparse  model that is within one standard deviation from the global optimum (Hastie et  al. 2001), the same criterion also used in the pls package for determining the  optimal number of latent variables mentioned in Sect. 8.2.2. > gas.lasso.cv  <- cv.glmnet(gasoline$NIR[gas.odd, ], + gasoline$octane[gas.odd]) > svals  <- gas.lasso.cv[c("lambda.1se", "lambda.min")]  The plot command for the  cv.glmnet object leads to the validation plot in the right panel of Fig. 10.2.  The global minimum in the CV curve lies at a value of −4.215, and the one-se  criterion at −3.424 (both in log units, as in ...