sato9hara / defragTrees

Python code for tree ensemble interpretation
MIT License
83 stars 22 forks source link

Feature request: tree visualization + LightGBM support #1

Closed tantrev closed 6 years ago

tantrev commented 6 years ago

It would just be really nice to visualize the rules defragTrees generates in a graphical tree (similar to scikit-learn), and if there was support for the ensemble trees from LightGBM.

sato9hara commented 6 years ago

Thank your very much for your comment/request.

I have added a new parser "parseLGBtrees" for LightGBM. I also added a simple example "example_lgb.py". Hope these will help you. Note that categorical features in LightGBM is not supported (as it is not the ensemble of binary decision trees that defragTrees targets for).

Regarding visualization, as the output of defragTrees is a set of rules but not a tree, there is no straightforward way to visualize. I welcome any suggestions on this point.

tantrev commented 6 years ago

Thank you so much! That was really nice of you to respond so quickly, especially with example code.

Thank you also for the clarification on the tree visualization and I apologize for my confusion. It might be worth considering auto-highlighting data points falling within defragTree's rules in a parallel coordinates plot? For example, plot.ly's implementation permits the use of the "constraintrange" parameter, that is somewhat analogous to the rules generated by defragTree.