使用 MSE 在 MLR 上拆分决策树

Using MSE to split decision tree on MLR

我正在尝试使用 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

没有任何想法

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)