Caret on R spills "unable to find variable "optimismBoot"" error message

1.5k views Asked by At

I have been testing caret on R to test neural network features. As I run the script below, it was working correctly, this has been starting outputting "unable to find variable "optimismBoot".

library(doParallel)
cl <- makePSOCKcluster(4)
registerDoParallel(cl)
library(caret)
m<-rbind(c(1,2,3),c(4,5,6),c(7,8,9))
train_data<-as.data.frame(m)
nnmodel <- train(
  V3 ~ ., 
  data = train_data,
  method = "nnet", 
  preProcess = c('center', 'scale'),
  trControl = trainControl(method = "cv"),
  tuneGrid = expand.grid(size=c(1:10), decay=seq(0.1, 1, 0.1)),
  linout = T
)

Why?

[environment]
Windows 10 64bit
R 3.4.1
RStudio
2

There are 2 answers

1
RobW On

I did not get this problem resolved by reverting to R version 3.3.3. Also, my other computer has R 3.4.0 installed which has no problem with caret. Strange voodoo... ... Update: The problem could involve the package snow. Switching off parallelization (unloading the doParallel package) resolved the problem for me.

3
Len Greski On

This issue is a caret defect that was repaired in the September 11, 2017 release of caret. Install the github version of caret with devtools::install_github('topepo/caret/pkg/caret').

See issue #706 on the caret github site for details.

regards,

Len