插入包不使用所有核心

时间:2018-06-13 07:47:50

标签: r r-caret doparallel

我在具有36个核心的AWS实例上运行模型。虚拟数据示例:

library(mlbench)
data(Sonar)
library(caret)
library(doParallel)
set.seed(95014)

# create training & testing data sets

inTraining <- createDataPartition(Sonar$Class, p = .75, list=FALSE)
training <- Sonar[inTraining,]
testing <- Sonar[-inTraining,]

# set up training run for x / y syntax because model format performs poorly
x <- training[,-61]
y <- training[,61]

cl <- makePSOCKcluster(36)
registerDoParallel(cl) 
fitControl <- trainControl(method = "cv",
                           number = 5,
                           allowParallel = TRUE)
fit <- train(x,y, method="cforest",data=Sonar,trControl = fitControl)
stopCluster(cl)

但是当我在htop中查看时,只有一半的核心在计算。 doParallelcaret是否存在核心限制?

enter image description here

0 个答案:

没有答案