【发布时间】:2019-03-20 09:03:50
【问题描述】:
我正在尝试重现此处给出的示例:
https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/mgcv-parallel.html
具体来说,在 mgcv::bam() 中使用 cluster= 参数。
可重现的例子:
require(mgcv)
require(parallel)
k <- 13;bs <- "cr"; set.seed(9)
dat <- gamSim(1,n=6000,dist="poisson",scale=.1)
nc <- 2 ## cluster size, set for example portability
if (detectCores()>1) { ## no point otherwise
cl <- makeCluster(nc)
} else cl <- NULL
system.time(b3 <- bam(y ~ s(x0,bs=bs,k=7)+s(x1,bs=bs,k=7)+s(x2,bs=bs,k=k)
,data=dat,family=poisson(),chunk.size=5000,cluster=cl))
这导致我的机器出现以下错误:
checkForRemoteErrors(val) 中的错误:2 个节点产生错误;第一的 错误:没有适用于“预测”的方法应用于 “gam”类计时停止于:0.31 0 0.37
其他可能有用的信息:
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
我的机器有 4 个内核和 16 GB RAM。
谢谢。
【问题讨论】:
-
我无法用
parallel 3.5.1和mgcv 1.8.27和R 3.5.1重现错误,我得到了正确的结果。也许更新软件包可能会有所帮助?
标签: r parallel-processing gam mgcv