Is there anyway we could print iteration when using the caret::train
function in parallel? I know there is option called verbose but it seems it doesn't print anything if I use multicore.
I've found a solution. All we need is to register cores via makeCluster function.
library(doSNOW)
cl <- makeCluster(30, outfile="")
registerDoSNOW(cl)
In this way, the log will be printed in console. I've tested on regular R/ Rstudio/ Rserver in mac/window/ubuntu (even AWS)
For example,
iris <- iris[1:100,]
iris$Species <- as.factor(as.character(iris$Species))
tc <- trainControl(method="LGOCV",
summaryFunction=twoClassSummary,
classProb=T,verboseIter=TRUE)
train.rf <- train(Species ~ .,data=iris,
method="rf", trControl=tc,
metric = "ROC")
will print
Type: EXEC
loaded caret and set parent environment
Type: EXEC
loaded caret and set parent environment
Type: EXEC
Type: EXEC
+ Resample01: mtry=2
+ Resample01: mtry=3
- Resample01: mtry=3
Type: EXEC
+ Resample02: mtry=2
- Resample01: mtry=2
Type: EXEC
+ Resample01: mtry=4
- Resample02: mtry=2
Type: EXEC
+ Resample02: mtry=3
- Resample01: mtry=4
Type: EXEC
+ Resample02: mtry=4
- Resample02: mtry=3
Type: EXEC
+ Resample03: mtry=2
- Resample02: mtry=4
Type: EXEC
+ Resample03: mtry=3
- Resample03: mtry=2
Type: EXEC
+ Resample03: mtry=4
- Resample03: mtry=3
Type: EXEC
+ Resample04: mtry=2
- Resample03: mtry=4
Type: EXEC
+ Resample04: mtry=3
- Resample04: mtry=2
Type: EXEC
+ Resample04: mtry=4
- Resample04: mtry=3
Type: EXEC
+ Resample05: mtry=2
- Resample04: mtry=4
Type: EXEC
+ Resample05: mtry=3
- Resample05: mtry=2
Type: EXEC
+ Resample05: mtry=4
- Resample05: mtry=3
Type: EXEC
+ Resample06: mtry=2
- Resample05: mtry=4
Type: EXEC
+ Resample06: mtry=3
- Resample06: mtry=2
Type: EXEC
+ Resample06: mtry=4
- Resample06: mtry=3
Type: EXEC
+ Resample07: mtry=2
- Resample06: mtry=4
Type: EXEC
- Resample07: mtry=2
+ Resample07: mtry=3
Type: EXEC
+ Resample07: mtry=4
- Resample07: mtry=3
- Resample07: mtry=4
Type: EXEC
Type: EXEC
+ Resample08: mtry=2
+ Resample08: mtry=3
- Resample08: mtry=3
Type: EXEC
+ Resample09: mtry=2
- Resample08: mtry=2
Type: EXEC
+ Resample08: mtry=4
- Resample09: mtry=2
Type: EXEC
+ Resample09: mtry=3
- Resample08: mtry=4
Type: EXEC
+ Resample09: mtry=4
- Resample09: mtry=3
Type: EXEC
+ Resample10: mtry=2
- Resample09: mtry=4
Type: EXEC
+ Resample10: mtry=3
- Resample10: mtry=2
Type: EXEC
+ Resample10: mtry=4
- Resample10: mtry=3
Type: EXEC
+ Resample11: mtry=2
- Resample10: mtry=4
Type: EXEC
+ Resample11: mtry=3
- Resample11: mtry=2
Type: EXEC
+ Resample11: mtry=4
- Resample11: mtry=3
Type: EXEC
+ Resample12: mtry=2
- Resample11: mtry=4
Type: EXEC
+ Resample12: mtry=3
- Resample12: mtry=2
Type: EXEC
+ Resample12: mtry=4
- Resample12: mtry=3
Type: EXEC
+ Resample13: mtry=2
- Resample12: mtry=4
Type: EXEC
+ Resample13: mtry=3
- Resample13: mtry=2
Type: EXEC
+ Resample13: mtry=4
- Resample13: mtry=3
Type: EXEC
+ Resample14: mtry=2
- Resample14: mtry=2
Type: EXEC
+ Resample14: mtry=4
- Resample14: mtry=4
Type: EXEC
+ Resample15: mtry=2
- Resample15: mtry=2
Type: EXEC
+ Resample15: mtry=3
- Resample15: mtry=3
Type: EXEC
+ Resample15: mtry=4
- Resample13: mtry=4
Type: EXEC
+ Resample14: mtry=3
- Resample15: mtry=4
Type: EXEC
+ Resample16: mtry=2
- Resample14: mtry=3
Type: EXEC
+ Resample16: mtry=3
- Resample16: mtry=2
Type: EXEC
+ Resample16: mtry=4
- Resample16: mtry=3
Type: EXEC
+ Resample17: mtry=2
- Resample17: mtry=2
Type: EXEC
+ Resample17: mtry=4
- Resample17: mtry=4
Type: EXEC
+ Resample18: mtry=2
- Resample18: mtry=2
Type: EXEC
+ Resample18: mtry=3
- Resample16: mtry=4
Type: EXEC
+ Resample17: mtry=3
- Resample18: mtry=3
Type: EXEC
+ Resample18: mtry=4
- Resample17: mtry=3
Type: EXEC
+ Resample19: mtry=2
- Resample18: mtry=4
Type: EXEC
+ Resample19: mtry=3
- Resample19: mtry=2
Type: EXEC
+ Resample19: mtry=4
- Resample19: mtry=3
Type: EXEC
+ Resample20: mtry=2
- Resample19: mtry=4
Type: EXEC
+ Resample20: mtry=3
- Resample20: mtry=2
Type: EXEC
+ Resample20: mtry=4
- Resample20: mtry=3
Type: EXEC
+ Resample21: mtry=2
- Resample20: mtry=4
Type: EXEC
+ Resample21: mtry=3
- Resample21: mtry=2
Type: EXEC
+ Resample21: mtry=4
- Resample21: mtry=3
Type: EXEC
- Resample21: mtry=4
+ Resample22: mtry=2
Type: EXEC
+ Resample22: mtry=3
- Resample22: mtry=3
Type: EXEC
+ Resample23: mtry=2
- Resample22: mtry=2
Type: EXEC
+ Resample22: mtry=4
- Resample23: mtry=2
Type: EXEC
+ Resample23: mtry=3
- Resample22: mtry=4
Type: EXEC
+ Resample23: mtry=4
- Resample23: mtry=3
Type: EXEC
+ Resample24: mtry=2
- Resample23: mtry=4
Type: EXEC
+ Resample24: mtry=3
- Resample24: mtry=2
Type: EXEC
+ Resample24: mtry=4
- Resample24: mtry=3
Type: EXEC
+ Resample25: mtry=2
- Resample24: mtry=4
Type: EXEC
+ Resample25: mtry=3
- Resample25: mtry=2
Type: EXEC
+ Resample25: mtry=4
- Resample25: mtry=3
- Resample25: mtry=4
Aggregating results
Selecting tuning parameters
Fitting mtry = 2 on full training set
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With