Parallelizing Machine Learning Algorithms

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)
Spread the Word!
Share
Related Posts
About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 10 years of experience in data science. During his tenure, he has worked with global clients in various domains like Banking, Insurance, Private Equity, Telecom and Human Resource.

1 Response to "Parallelizing Machine Learning Algorithms"
  1. Why do we need to run parallel algorithm?

    ReplyDelete

Next → ← Prev

Looks like you are using an ad blocker!

To continue reading you need to turnoff adblocker and refresh the page. We rely on advertising to help fund our site. Please whitelist us if you enjoy our content.