Closed jxu closed 9 months ago
?glmnet
says "The regularization path is computed for the lasso or elasticnet penalty at a grid of values for the regularization parameter lambda." I'm not sure if that means one process trains multiple models simultaneously.
Hello 👋
This is happening because a glmnet model can be fit using the submodel trick, which you can read more about here: https://parsnip.tidymodels.org/articles/Submodels.html
So what is happening is that when you fit a glmnet model, it can be fit for multiple penalty
values at once, and then at prediction decide which penalty
value you want to use.
So in practice what happens is that instead of fitting 25 models, it fits 5 models, one for each unique value of mixture
.
Thanks. Perhaps that can be added to the parsnip glmnet docs.
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.
When using a tunable model like
logistic_reg(penalty=tune(), mixture=tune()) %>% set_engine("glmnet")
and multi-dimensional grid likegrid_regular(penalty(), mixture(), levels=5)
, there are 25 separate models. So afterregisterDoParallel(cores=32)
, why are only five processes are spawned? And without parallel and withcontrol_grid(verbose=T)
, the progress still saysmodel 1/5
. Is this intended?