0

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...

IDK
  • 359
  • 1
  • 16
  • 1
    It seems you did not load the packages via `library()`. What does `parallelGetRegisteredLevels()` return? More information can be found here: https://mlr.mlr-org.com/articles/tutorial/parallelization.html. There is also no need to prefix all functions with the namespace, just call `library(mlr)` once. – pat-s Sep 24 '22 at 19:12

0 Answers0