我正在使用 mlr3 包,我想为不同的模型绘制 ROC 曲线。如果我按照文档中的说明使用交叉验证,它工作得很好,但是如果我使用“holdout”进行重采样,那么我会得到一个错误Error: Invalid show_cb. Inconsistent with calc_avg of evalmod.
。
这是代码:
library("mlr3")
library("mlr3learners")
library("mlr3viz")
# one task only
tasks = lapply(c("german_credit"), tsk)
# get some learners and for all learners ...
# * predict probabilities
# * predict also on the training set
learners = c("classif.featureless", "classif.rpart", "classif.ranger", "classif.kknn")
learners = lapply(learners, lrn,
predict_type = "prob")
# compare via 3-fold cross validation
resamplings = rsmp("holdout", ratio = .8) # holdout instead of cv
# create a BenchmarkDesign object
design = benchmark_grid(tasks, learners, resamplings)
print(design)
bmr = benchmark(design)
autoplot(bmr, type = "roc")
感谢您的帮助,马修