Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix seed for future #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix seed for future #36

wants to merge 1 commit into from

Conversation

shfischer
Copy link
Member

It looks like there is a bug in how the seed argument is passed to future:

mse/R/mp.R

Line 214 in 4f50190

.options.future=list(globals=structure(TRUE, seed=seed)),

If random numbers are generated when run in parallel, future returns a warning, even when seed=TRUE defined in args:

1: UNRELIABLE VALUE: Iteration 1 of the foreach() %dofuture% { ... }, part of chunk #1 (‘doFuture2-1’), 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, specify foreach() argument '.options.future = list(seed = TRUE)'. 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".

I think the seed argument should be outside of structure():
.options.future=list(seed=seed, globals=structure(TRUE))
instead of
.options.future=list(globals=structure(TRUE, seed=seed))
which removes the warning message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant