我想在mlr3中使用distRforest包创建一个学习器。
我的代码如下:
library(mlr3extralearners)create_learner( pkg = "." , classname = 'distRforest', algorithm = '回归树', 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宇宙的兴趣!有几点需要注意,首先书中的例子对我来说运行得很好,其次您的例子无法工作,因为您为regr
学习器包含了classif
属性。由于我无法重现您的错误,很难调试哪里出了问题,如果您能运行以下代码会很有帮助:
reprex::reprex({ create_learner( pkg = ".", classname = "Rpart", algorithm = "决策树", 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并在那里开启一个issue。