简体   繁体   English

是否有一个库可以提供更好的决策树图片,或者是否有另一种方法可以让我的决策树在 R 中更易于阅读?

[英]Is there a library to provide a better decision tree picture or is there another way to make my decision tree easier to read in R?

I have a classification model using the c5.0 algorithm with a script like this.我有一个分类 model 使用 c5.0 算法和这样的脚本。 pola = C5.0(train_set[,-8], train_set[,8])

Then I display the decision tree with this script.然后我用这个脚本显示决策树。 plot(pola, type="s", main="Decision Tree")

And the results of the post give the writing attributes that overlap with each other like in this picture.并且帖子的结果给出了像这张图片一样相互重叠的写作属性。 在此处输入图像描述

So, is there a library to provide a better tree picture or is there another way to make my tree easier to read?那么,是否有一个库可以提供更好的树图片,或者是否有其他方法可以让我的树更易于阅读? Thanks you.谢谢。

The problem sees to be "size" rather than a bad decision tree graph.问题看起来是“大小”而不是糟糕的决策树图。 One option would be to save it as an image and open it externally with much greater size.一种选择是将其保存为图像并以更大的尺寸在外部打开它。 Eg something similar to:例如类似于:

png(file = 'mytree.png', width = 920, height = 1260)
plot(pola, type="s", main="Decision Tree")
dev.off()
# Open directory with image (credit to [this answer][1])
if (.Platform['OS.type'] == "windows"){
    shell.exec(getwd())
} else {
    system(paste(Sys.getenv("R_BROWSER"), getwd()))
}

This of course this will make it so, that you might have to scroll around to see the individual parts of the tree.当然,这将使它如此,您可能必须滚动查看树的各个部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM