I'm trying to split my decision tree in MLR using MSE. Here's my code
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
)
And it gives me the error
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!
I Know how to do this onrpart
. But have no ideia on MLR
The split
parameter is passed in a list under rpart(..., parms = list(split = "mse"))
. Therefore it can be set within mlr like this:
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)
In the result we can see that it was passed correctly
m$learner.model$call
# rpart::rpart(formula = f, data = d, parms = list(split = "mse"), xval = 0L)