如何让决策树的标签在R中可见?

时间:2017-12-26 08:53:51

标签: r

我正在处理机器学习问题,并且我使用决策树来使用下面显示的代码得出结论:

library(RColorBrewer)
library(rpart.plot)
library(rpart)
library(rattle)

set.seed(27)
fit <- rpart(Achat_client ~ .,
             data = train_,
             method = "class",
             control = rpart.control(xval = 10, minbucket = 2, cp = 0), parms = list(split = "information"))

fancyRpartPlot(fit)

但我收到警告信息:

  

警告信息:实验室甚至不适合在cex 0.15,可能有一些   overplotting

我的决策树上有一些看不见的标签。  You can see it here

我该怎么处理这个问题呢?

1 个答案:

答案 0 :(得分:0)

您可以尝试导出为PDF并通过PDF查看器放大:

pdf("tree.pdf")
fancyRpartPlot(fit)
dev.close()
system("evince tree.pdf") # If you have the evince PDF viewer installed
相关问题