1

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

我的代码:

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

4

1 回答 1

1

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

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 并在那里打开问题。

于 2020-11-11T20:03:44.447 回答