6
$\begingroup$

Is there a direct way to visualize a c5.0 decision tree? Here my code:

library(C50)
data(churn)
myTree = C5.0(x = churnTrain[, -20], y = churnTrain$churn)
summary(myTree)

I am getting a long list of C5.0 objects from a program that I do not control but I could convert it into something else if that is absolutely necessary. Any ideas/pointers are highly appreciated.

$\endgroup$
1

1 Answer 1

8
$\begingroup$

I might be missing something in your question but simply

plot(myTree)

gives you a visualization of the tree (based on the infrastructure in partykit)

C5.0 tree

Of course the tree is very large and you either need to zoom into the image or use a large screen to read it...

You can also use partykit to just display subtrees. For example if you want to just show the left branch below the root (starting from node 2) and the right branch below the root (starting from node 33) you could do:

library("partykit")
myTree2 <- C50:::as.party.C5.0(myTree)
plot(myTree2[2])
plot(myTree2[33])
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.