2
$\begingroup$

I'm using gmlnet to learn lasso regression model.

model<-cv.glmnet(x, y, alpha=1, nfolds=10,parallel= TRUE)

when I learn model and look at the model it's like this :

Df     %Dev   Lambda

 [79,] 411 0.766800 0.003736
 [80,] 421 0.773000 0.003566
 [81,] 433 0.779200 0.003404
 [82,] 438 0.785000 0.003249
 [83,] 444 0.791200 0.003102
 [84,] 452 0.796500 0.002961
 [85,] 453 0.802000 0.002826
 [86,] 455 0.807600 0.002698
 [87,] 457 0.812700 0.002575
 [88,] 462 0.817700 0.002458
 [89,] 467 0.822400 0.002346
 [90,] 473 0.827000 0.002240
 [91,] 478 0.831400 0.002138
 [92,] 478 0.836100 0.002041
 [93,] 484 0.840400 0.001948
 [94,] 491 0.844600 0.001859
 [95,] 498 0.848700 0.001775
 [96,] 504 0.852800 0.001694
 [97,] 504 0.856700 0.001617
 [98,] 511 0.860100 0.001544
 [99,] 516 0.863300 0.001474
[100,] 515 0.866500 0.001407

but when I look at the coefficients of model, all are zero. I just have intercept.

How is it possible I have high deviance, but no features has non-zero coefficient ?

$\endgroup$
1
$\begingroup$

When you use coef(model) to print coefficients of model after cross validation, the default returns the best model in a sequence of models,which corresponds to the model$lambda.min/lse,this value may be very high in your first few lines of list that you haven't shown.

Your list just show the low value of lambdas, its corresponding dev.ratio is very high and the number of nonzero-coefficients ranges from 400~500.

All in all, the model with "high deviance" is not the model of all zero coefficients.They're different models.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.