4

I am using the train() function of caret package with method='nnet', and I have registered 6 cores using doMC. But it uses only one core.

This is my code:

library(caret)
library(foreach)
library(doMC)
registerDoMC(cores = 6)

.... some code...

nnmodel.grid <- expand.grid(.size=c(100,50))
myTrainControl = trainControl(allowParallel=TRUE)
nnmodel.fit <- train(formulaForNN, data = trainingdata, method = "nnet", tuneGrid = 
nnmodel.grid, trControl = myTrainControl)

Though the answer at this link shows that all the registered core can be used. The only difference I can see is

tc <- trainControl(method="boot",number=25)

i.e. he uses a 'boot' method for resampling.

Does that means caret only uses multicore for resampling, and without using any resampling techniques we can't train neural networks in parallel ?

Community
  • 1
  • 1
Abhishek
  • 3,337
  • 4
  • 32
  • 51

0 Answers0