在R中的mlr包中可视化classif.rpart树

时间:2019-01-31 07:56:54

标签: r

我可以知道如何可视化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对象,在此先感谢

0 个答案:

没有答案