Rambatino / CHAID

A python implementation of the common CHAID algorithm
Apache License 2.0
149 stars 50 forks source link

how to graphically display the tree? #93

Closed greghor closed 5 years ago

greghor commented 5 years ago

Is there any tool available to visualize the chaid tree? Maybe something equivalent to export_graphiz for CART?

Rambatino commented 5 years ago

There is this: https://github.com/Rambatino/CHAID/blob/master/CHAID/tree.py#L198 image

Which uses https://github.com/Rambatino/CHAID/blob/master/CHAID/tree.py#L2

If you look at the treelib source code there is this: https://github.com/caesar0301/treelib/blob/master/treelib/tree.py#L865

image

Which I think is what you want. So you should be able to do:

tree.to_tree().to_graphviz(filename="") # untested
greghor commented 5 years ago

Thanks for your reply! I ll take a look at it!

Rambatino commented 5 years ago

@greghor have a look at https://github.com/Rambatino/CHAID/pull/94