Reputation: 65
I have a classification model using the c5.0 algorithm with a script like this.
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.
Upvotes: 1
Views: 439
Reputation: 8572
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
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.
(credit to this answer, for inspiration to open file explorer through R)
Upvotes: 1