有没有一个库可以提供更好的决策树图片,或者有其他方法可以让我的决策树在R中更容易阅读?

问题描述 投票:0回答:1

我有一个使用c5.0算法的分类模型,脚本是这样的。pola = C5.0(train_set[,-8], train_set[,8])

然后我用这个脚本显示决策树。plot(pola, type="s", main="Decision Tree")

而帖子的结果就像这张图一样,给出了相互重叠的写作属性。enter image description here

那么,有没有一个库可以提供更好的树图,或者有其他方法让我的树更容易阅读呢,谢谢你。

r plot decision-tree
1个回答
0
投票

问题在于 "大小",而不是决策树图的问题。一个选择是将其保存为图像,然后以更大的尺寸从外部打开。例如类似于。

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()))
}

当然,这将使它,你可能不得不滚动查看树的各个部分。

© www.soinside.com 2019 - 2024. All rights reserved.