在 mlr3 中创建学习者:sprintf(msg, ...) 错误:参数太少

creating learner in mlr3: Error in sprintf(msg, ...) : too few arguments

我想在 mlr3 中创建一个学习者,使用 distRforest 包。

我的代码:

library(mlr3extralearners)

create_learner( pkg = "." ,
            classname = 'distRforest',
            algorithm = 'regression tree',
            type = 'regr',
            key = 'distRforest',
            package = 'distRforest',
            caller = 'rpart',
            feature_types = c("logical", "integer", "numeric","factor", "ordered"),
            predict_types = c('response'),
            properties = c("importance", "missings", "multiclass",
                           "selected_features", "twoclass", "weights"),
            references = FALSE,
            gh_name = 'CL'

)

给出以下错误:sprintf(msg, ...) 错误:参数太少

事实上,复制教程中的代码 https://mlr3book.mlr-org.com/extending-learners.html 会引发相同的错误。

有什么想法吗?非常感谢 - c

感谢您对扩展 mlr3 宇宙的兴趣! 有几件事,首先,书中的示例对我来说很好用,其次,您的示例不起作用,因为您包含 classif 学习者的 classif 属性。由于我无法重现您的错误,因此我很难调试出了什么问题,如果您可以 运行 以下内容将会很有帮助:

reprex::reprex({
  create_learner(
    pkg = ".",
    classname = "Rpart",
    algorithm = "decision tree",
    type = "classif",
    key = "rpartddf",
    package = "rpart",
    caller = "rpart",
    feature_types = c("logical", "integer", "numeric", "factor", "ordered"),
    predict_types = c("response", "prob"),
    properties = c("importance", "missings", "multiclass", "selected_features", "twoclass", "weights"),
    references = TRUE,
    gh_name = "CL"
  )
}, si = TRUE)

如果您仍然遇到错误并且输出太长而无法在此处打印,请转到 GitHub 并在那里打开一个问题。