在R中使用foreach()创建随机森林时,我收到错误,找不到randomForest()函数

时间:2015-05-03 18:38:53

标签: r foreach random-forest doparallel

尝试在R中执行并行处理以使用3个核心创建51棵树的随机森林时,我收到错误 " randomForest(x,y,ntree = ntree)出错:   任务1失败 - "无法找到功能" randomForest""

请帮忙。我使用的代码如下:

library(doParallel)
library(randomForest)
cl<-makeCluster(3)
registerDoParallel(cl)
cl
attach(train)
x<-train[,2:94]
y<-train$target
rf <- foreach(ntree=rep(17, 3), .combine=combine) %dopar% randomForest(x, y, ntree=ntree)

0 个答案:

没有答案