I'm performing ridge and lasso regression for feature selection. My actual issue is related to the comparison between the two models, for example:
models <- list(ridge = ridge, lasso = lasso)
If I check the models output:
$ridge
Call: cv.glmnet(x = x_train, y = y_train, type.measure = "mse", alpha = 0, family = "binomial")
Measure: Mean-Squared Error
Lambda Index Measure SE Nonzero
min 3.518 51 0.2656 0.02807 86
1se 5.103 47 0.2916 0.02601 86
$lasso
Call: cv.glmnet(x = x_train, y = y_train, type.measure = "mse", alpha = 1, family = "binomial")
Measure: Mean-Squared Error
Lambda Index Measure SE Nonzero
min 0.003518 51 0.04640 0.02799 16
1se 0.020603 32 0.07214 0.03088 17
I know that the best model is the one that one that minimizes the prediction error, so I use the following line:
resamples(models) %>%
summary(metric = "RMSE")
That line must give me a summary and a comparison between the two models. However, I got the following error:
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'object' in selecting a method for function 'summary': values must be length 1,
but FUN(X[[1]]) result is length 0
So far I can not understand how to fix this.
This option only works with the test data or can I use the complete set too?
What could be the potential issue here? or explanation?