我正在尝试使用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)
关于r - 使用MSE在MLR上拆分决策树,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49122085/