stan-dev / projpred

Projection predictive variable selection
https://mc-stan.org/projpred/
Other
110 stars 26 forks source link

negbin latent projection in latent vignette fails with parallel #497

Open avehtari opened 3 months ago

avehtari commented 3 months ago

Run latent.Rmd vignette until refm_nebin has been created. cv_varsel() works with parallel=FALSE, but

registerDoFuture();
plan(multisession, workers=8);
vs_nebin <- cv_varsel(refm_nebin, d_test = d_test_lat_poiss, method = "L1", nclusters_pred = 20, nterms_max = 14, parallel=TRUE)

fails with an error

Error in { : task 1 failed - "object 'refm_prec' not found"
fweber144 commented 3 months ago

Thanks for reporting. We probably need to replace lines https://github.com/stan-dev/projpred/blob/25748e84b367ca469b11a279ff9773a870525f53/R/cv_varsel.R#L1000 and https://github.com/stan-dev/projpred/blob/25748e84b367ca469b11a279ff9773a870525f53/R/cv_varsel.R#L1335 by something like

.export = c("one_obs", "dot_args", getOption("projpred.export_to_workers", character())),

and

.export = c("one_fold", "dot_args", getOption("projpred.export_to_workers", character())),

respectively. Then users can set the global option projpred.export_to_workers as needed.