Open
Description
When running a projection in parallel (across draws) using the doFuture package, the doFuture package claims that the pseudo-random number generator (PRNG) had been used. This is unexpected because the projection is deterministic, which can be checked by inspecting the source code of fit_glm_ridge_callback()
(including all functions used by it, and functions used by these, and so on).
Reprex:
data("df_gaussian", package = "projpred")
df_gaussian <- df_gaussian[1:29, ]
dat <- data.frame(y = df_gaussian$y, df_gaussian$x)
rfit <- rstanarm::stan_glm(y ~ X1 + X2 + X3 + X4 + X5,
data = dat,
chains = 1,
iter = 500,
seed = 1140350788,
refresh = 0)
library(projpred)
doFuture::registerDoFuture()
future::plan(future::multisession, workers = 4)
progressr::handlers(global = TRUE)
trigger_default <- options(projpred.prll_prj_trigger = 0L)
prj <- project(rfit,
predictor_terms = c("X1", "X2"),
seed = 46782345)
The last line throws 4 warnings (one per parallel worker), the last one (here for worker 4) being:
Warning: UNRELIABLE VALUE: One of the foreach() iterations (‘doFuture-4’)
unexpectedly generated random numbers without declaring so. There is a risk
that those random numbers are not statistically sound and the overall results
might be invalid. To fix this, use '%dorng%' from the 'doRNG' package instead
of '%dopar%'. This ensures that proper, parallel-safe random numbers are
produced via the L'Ecuyer-CMRG method. To disable this check, set option
'doFuture.rng.onMisuse' to "ignore".
Metadata
Metadata
Assignees
Labels
No labels