Error while parallelizing mlr::resample function in R

Viewed 9

I'm getting the error:

Error in parallelMap(doResampleIteration, seq_len(rin$desc$iters), level = "mlr.resample", : 
Level 'mlr.resample' not registered

while running this function:

train.model <- function(train){
  train_task <- mlr::makeClassifTask(data = train, target="target")
  parallelMap::parallelStartSocket(cpus= parallel::detectCores())
  rdesc <- mlr::makeResampleDesc("CV", iters=10L)
  
  rf_lrn <- mlr::makeLearner("classif.randomForest")
  rf_lrn$par.vals <- list(ntree = 100L, importance=TRUE)
  rf_res <- mlr::resample(learner = rf_lrn, task = train_task, 
                          resampling = rdesc, 
                          measures = list(mlr::tpr,mlr::fpr,mlr::fnr, mlr::tnr,mlr::acc), 
                          show.info = T)
  return(rf_res)
}

I've found this SO question but I don't think I'm parallelizing on multiple levels...

0 Answers
Related