我正以这种方式盯着降雪包工作:
library(snowfall)
sfInit(parallel=TRUE, cpus=6, type="SOCK")
#loading packages
sfLibrary(package = lars)
sfLibrary(package=covTest)
我想使用sfLapply多次计算的函数:
funkcja <- function(i,k=5)
{
beta <- c(k,k,0,k,k,rep(0,35))
X <- matrix(rnorm(100*40),100,40)
Y <- X%*%beta+rnorm(100)
lasso.lars <- lars(X,Y,intercept=FALSE,use.Gram=FALSE)
test <- covTest(lasso.lars,X,Y,sigma.est=1)
test
}
但是当我尝试这个时
sfLapply(1:100,funkcja)
我收到错误: “checkForRemoteErrors(val)出错:6个节点产生错误;第一个错误:未找到对象'Y'”。但是当我隐藏最后一行而改变lasso.lars的测试时,就不再有关于向量Y的重复:
funkcja <- function(i,k=5)
{
beta <- c(k,k,0,k,k,rep(0,35))
X <- matrix(rnorm(100*40),100,40)
Y <- X%*%beta+rnorm(100)
lasso.lars <- lars(X,Y,intercept=FALSE,use.Gram=FALSE)
#test <- covTest(lasso.lars,X,Y,sigma.est=1)
lasso.lars
}
我不明白这一点,因为行
test <- covTest(lasso.lars,X,Y,sigma.est=1)
应该可以工作
lars(X,Y,intercept=FALSE,use.Gram=FALSE)
可以工作。我将非常感谢你的帮助。
答案 0 :(得分:0)
我的猜测是Y隐藏了内部变量。以下功能有效(改变了&#34; Y&#34;到&#34; y&#34;的情况)
File "<ipython-input-1-2e5c536b7c65>", line 1, in <module>
import pymc3 as pm
File "C:\Anaconda3\lib\site-packages\pymc3\__init__.py", line 5, in <module>
from .distributions import *
File "C:\Anaconda3\lib\site-packages\pymc3\distributions\__init__.py", line 1, in <module>
from . import timeseries
File "C:\Anaconda3\lib\site-packages\pymc3\distributions\timeseries.py", line 1, in <module>
import theano.tensor as tt
File "C:\Anaconda3\lib\site-packages\theano\__init__.py", line 110, in <module>
from theano.compile import (
File "C:\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
from theano.compile.mode import *
File "C:\Anaconda3\lib\site-packages\theano\compile\mode.py", line 11, in <module>
import theano.gof.vm
File "C:\Anaconda3\lib\site-packages\theano\gof\vm.py", line 674, in <module>
from . import lazylinker_c
File "C:\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 140, in <module>
preargs=args)
File "C:\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2344, in compile_str
compile_stderr = decode(p_out[1])
File "C:\Anaconda3\lib\site-packages\theano\compat\__init__.py", line 43, in decode
return x.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 1636: invalid continuation byte