0

I have some difficulty using the function resample of mlr package, in my case for example.

library(mlr)

learners = makeLearners(cls = c("C50", "rpart","ada","naiveBayes"), type = "classif", predict.type = "prob")

data_task = makeClassifTask(data = dataset, target = "y_dx")

repCV = makeResampleDesc(method = "RepCV", folds = 5 ,stratify = TRUE)
valCV = resample(
    learners = learners, 
    task = data_task, 
    resampling = repCV, 
    measures = list(mmce, acc, auc))

when running the variable valCV, it generates the following error

Error in checkLearner(learner) : argument "learner" is missing, with no default

The problem is that it doesn't recognize the learners argument, is there any other way to solve this?

royer
  • 615
  • 1
  • 6
  • 19
  • Have you tried `mlr3`. I get a warning message while loading the package mlr `Warning message: 'mlr' is in 'maintenance-only' mode since July 2019. Future development will only happen in 'mlr3'.. Due to the focus on 'mlr3' there might be uncaught bugs meanwhile in {mlr} - please consider switching.` – akrun Apr 27 '23 at 17:16
  • hi @akrun , the package mlr3 It has other functions that I don't know about but I'll check it out, thank you very much – royer Apr 28 '23 at 00:14

1 Answers1

0

resample() takes only a single learner -- did you mean to use benchmark()?

benchmark(
  learners = learners, 
  task = data_task, 
  resampling = repCV, 
  measures = list(mmce, acc, auc))

And as the comment points out, you should switch to mlr3. See the book chapter on evaluation and benchmark experiments.

Lars Kotthoff
  • 107,425
  • 16
  • 204
  • 204