In R, we can run machine learning algorithms in parallel model with doParallel and caret packages.
library(caret)
library(doParallel)
set.seed(1)
ctrl <- trainControl(method="repeatedcv", repeats=5, classProbs=TRUE)
#Run model in parallel
cl <- makeCluster(detectCores())
registerDoParallel(cl)
getDoParWorkers()
model = train(Species~., data = iris, method='rf', trControl= ctrl)
Why do we need to run parallel algorithm?
ReplyDelete