我使用的是创建新线程的future.callr (?)每次请求一个未来时,都会单独计算它,并且主R脚本可以继续前进。
当我的未来回归时,我会收到以下警告:
Warning message:
UNRELIABLE VALUE: Future (‘<none>’) unexpectedly generated random numbers without specifying argument 'seed'. There is a risk that those random numbers are not statistically sound and the overall results might be invalid. To fix this, specify 'seed=TRUE'. This ensures that proper, parallel-safe random numbers are produced via the L'Ecuyer-CMRG method. To disable this check, use 'seed=NULL', or set option 'future.rng.onMisuse' to "ignore".在我运行的实际代码中,它只是加载了一些数据,我不知道为什么(或者关心编辑:我确实关心,参见下面的注释),它正在生成随机数。如何停止显示该警告(修复rng生成或直接忽略它)?
我有很多关于期货的行,所以我希望能够以某种方式在开始时设置选项,而不是必须将其添加到每一行。
这是一个例子,我试图忽略这个警告。
library(future.callr)
set.seed(1234567)
future.seed = TRUE
#normal random number - no problem
a<-runif(1)
print(a)
#random number in future, using callr plan
plan(callr, future.rng.onMisuse = 'ignore')
b %<-% runif(1)
print(b)发布于 2021-10-01 23:18:17
参见help("%seed%", package = "future")。
您可以使用如下所示的%seed%:
b %<-% runif(1) %seed% TRUE # seed is set by future pkg
print(b)
# or
b %<-% runif(1) %seed% 1234567 # your seed
print(b)或禁用检查
options(future.rng.onMisuse = "ignore")
b %<-% runif(1)
print(b)https://stackoverflow.com/questions/69365728
复制相似问题