Caret training function - it is not possible to find the variable "optimismBoot"

I am new to R and RStudio and have experimented with smart modeling. The following train function works without parallel processing, but when I implement doSNOW makeCluster, I get the error below related to a variable named "optimismBoot". I searched in vain for permission, tried to install and uninstall packages, but nothing works. Any insight was appreciated.

cl <- makeCluster(2, type = "SOCK") registerDoSNOW(cl) caret.cv <- train(ReturnedToMF ~ ., data = trees.cetstrain, method = "xgbTree", tuneGrid = tune.grid, trControl = cetstrain.control) Error in e$fun(obj, substitute(ex), parent.frame(), e$data) : unable to find variable "optimismBoot" 

I found the following link on this site, but it actually does not provide a solution for parallel processing: Affect R-straits and "cannot find the variable" optimismBoot "" error message

+7
parallel-processing r caret
source share
3 answers

There is a link to this issue on the Caret github page. They seem to have fixed it recently.

See here: https://github.com/topepo/caret/issues/706

In this case, I suppose installing caret directly from github should solve the problem.

devtools::install_github('topepo/caret/pkg/caret')

See here: https://github.com/topepo/caret

Follow these steps: (I assume you are using RStudio)

  • Install devtools package as usual
  • Run the command devtools::install_github('topepo/caret/pkg/caret') and check the output to make sure the package is updated from github
  • Restart RStudio / R. The curt version in the package explorer will be the same as before, but the package will use the new code
  • To make sure it is updated, you can output the source code for this modified internal function with caret:::nominalTrainWorkflow and verify that the following line is there: export <- c("optimism_xy") . If you do this right now, the line will be optimismBoot instead of optimism_xy

PS: The latest version of Caret is dated September 7, 2017. Therefore, the update should also solve the problem.

+23
source share

I had to deal with this problem when I updated packages, the new caret version is caret_6.0-77, now I solve it by downloading the old version of caret is caret_6.0-76 package from the crane archive packages, see this link. Click here ! and then install the package file locally using Rstudio in the Tools menu, and then select the installation packages that appear in the dialog box, select the installation from the file (.extension) menu

I hope this is helpful

+2
source share

I would say using an example from the documentation for parallel processing.

 library(parallel) library(doMC) # use all cores except one doMC::registerDoMC(cores = parallel::detectCores() - 1) 

In order for all you need to do, you can run train() , and it should use the number of kernels you specified. I adapted it a bit to dynamically determine the number of cores with the parallel library.

0
source share

All Articles