use*_*275 5 memory memory-management cluster-computing deep-learning h2o
data1.dl.r2 = vector()
for (i in 1:100) {
if (i==1) {
data1.hex = as.h2o(data1)
} else {
data1.hex = nextdata
}
data1.dl = h2o.deeplearning (x=2:1000,y=1,training_frame=data1.hex,nfolds=5,activation="Tanh",hidden=30,seed=5,reproducible=TRUE)
data1.dl.pred = h2o.predict(data1.dl,data1.hex)
data1.dl.r2[i] = sum((as.matrix(data1.dl.pred)-mean(as.matrix(data1.hex[,1])))^2)/
sum((as.matrix(data1.hex[,1])-mean(as.matrix(data1.hex[,1])))^2) # R-squared
prevdata = as.matrix(data1.hex)
nextpred = as.matrix(h2o.predict(data1.dl,as.h2o(data0[i,])))
colnames(nextpred) = "response"
nextdata = as.h2o(rbind(prevdata,cbind(nextpred,data0[i,-1])))
print(i)
}
Run Code Online (Sandbox Code Playgroud)
这是我的代码,其中包含100个观测值和1000个要素的数据集(data1)。运行此命令时,它在第50〜60次迭代时给了我一条错误消息“
Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page, :
ERROR MESSAGE:
Total input file size of 87.5 KB is much larger than total cluster memory of Zero , please use either a larger cluster or smaller data.
Run Code Online (Sandbox Code Playgroud)
当我运行“ h20.init()”时,它告诉我群集总内存为零。
H2O cluster total nodes: 1
H2O cluster total memory: 0.00 GB
H2O cluster total cores: 8
H2O cluster allowed cores: 8
H2O cluster healthy: TRUE
Run Code Online (Sandbox Code Playgroud)
因此,我想知道为什么群集总内存为零,为什么在早期迭代中它没有出错。
小智 5
您需要重新启动H2O群集。
尝试h2o.cluster().shutdown()然后h2o.init()。
您还可以通过显式设置分配给H2O的内存h2o.init(min_mem_size_GB=8),具体取决于您的计算机拥有多少内存。