我可以知道如何可视化mlr classif.rpart
中生成的树模型,还是可以打印树规则
makeatree <- makeLearner("classif.rpart", predict.type = "response")
set_cv <- makeResampleDesc("CV",iters = 3L)
gs <- makeParamSet(makeIntegerParam("minsplit",lower = 10, upper = 50),makeIntegerParam("minbucket", lower = 5, upper = 50),makeNumericParam("cp", lower = 0.001, upper = 0.2))
gscontrol <- makeTuneControlGrid()
stune <- tuneParams(learner = makeatree, resampling = set_cv, task = trainTask, par.set = gs, control = gscontrol, measures = acc)
t.tree <- setHyperPars(makeatree, par.vals = stune$x)
tpmodel <- predict(t.rpart, testTask)
t.rpart <- train(t.tree, trainTask)
在此处rpart.plot()
中显示树模型将不起作用,因为它不是rpart对象,在此先感谢