我有一个使用c5.0算法的分类模型,脚本是这样的。pola = C5.0(train_set[,-8], train_set[,8])
然后我用这个脚本显示决策树。plot(pola, type="s", main="Decision Tree")
那么,有没有一个库可以提供更好的树图,或者有其他方法让我的树更容易阅读呢,谢谢你。
问题在于 "大小",而不是决策树图的问题。一个选择是将其保存为图像,然后以更大的尺寸从外部打开。例如类似于。
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()))
}
当然,这将使它,你可能不得不滚动查看树的各个部分。