1

我正在尝试使用 MSE 在 MLR 中拆分我的决策树。这是我的代码

library(mlr)

cl = "classif.rpart"


getParamSet(cl)

learner = makeLearner(cl = cl
                      , predict.type = "prob"
                      #, predict.type = "response"
                      , par.vals = list(split="mse")
                      , fix.factors.prediction = TRUE
)

它给了我错误

Error in setHyperPars2.Learner(learner, insert(par.vals, args)) : 
  classif.rpart: Setting parameter split without available description object!
Did you mean one of these hyperparameters instead: minsplit cp xval
You can switch off this check by using configureMlr!

我知道如何在rpart. 但是不知道MLR

4

1 回答 1

2

参数在 下的split列表中传递rpart(..., parms = list(split = "mse"))。因此它可以像这样在 mlr 中设置:

library(mlr)
cl = "classif.rpart"
learner = makeLearner(cl = cl, predict.type = "prob", par.vals = list(parms = list(split="mse")), fix.factors.prediction = TRUE)
m = train(learner, iris.task)

在结果中我们可以看到它被正确传递了

m$learner.model$call
# rpart::rpart(formula = f, data = d, parms = list(split = "mse"), xval = 0L)
于 2018-03-12T15:29:32.773 回答