-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plot trees in R #1222
Comments
@yanyachen any idea? |
These go above and beyond what's current in xgb.plot.tree; would be great to have them in R for LightGBM http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8017582 |
A function similar to xgb.plot.multi.trees method would be especially useful for biological applications like setting gates for cell sorting, where model interpretation is pivotal. |
@Laurae2 if no one is working this, I can help with the feature request. |
@randxie In addition to my link above, another possible starting point is to extend SHAP (which is already implemented in python-lightgbm): https://github.com/slundberg/shap/blob/master/notebooks/Census%20income%20classification%20with%20LightGBM.ipynb |
@randxie You can base the charts on the following R package if you want a baseline to compare with xgboost: https://github.com/dmlc/xgboost/tree/master/R-package/R https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8017582 is also extremely interesting and go way beyond what LightGBM currently has as @zkurtz pointed out earlier.. Interactive link: http://shixialiu.com:8082/static/index.html |
Closed in favor of being in #2302. We decided to keep all feature requests in one place. Welcome to contribute this feature! Please re-open this issue (or post a comment if you are not a topic starter) if you are actively working on implementing this feature. |
Adding this comment to this discussion: #3188 (comment) hey @randxie are you still interested in trying this 😛 |
I wrote an R function called lgb.plot.tree to graph a single tree from a LightGBM model, along similar lines to XGBoost's xgb.plot.multi.trees (but my function at the moment only plots a single LightGBM tree). The function uses the DiagrammeR package (like XGBoost) to draw the tree graph. Three examples in the code at the bottom of this message and I have also attached the agaricus mushroom dataset in .csv format which is used by the code to graph an example tree based on a LightGBM using categorical features. I think there is already a tree diagram function for the Python LightGBM package - if there are already some tests for that function then it would probably make sense to use similar tests for this function - happy to do the work to set up these tests.
|
Thanks very much for your hard work @SpeckledJim2 ! As long as we can make Please open a pull request which adds this function in a new file
We can use the pull request for further feedback and suggestions. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This was locked accidentally. I just unlocked it. We'd still welcome contributions related to this feature! |
This seems work for me |
The python package has plotting functions to visualize the trees grown. Is there a plan to add the same functionalities to the R package? Something like xgboost's xgb.plot.tree and xgb.plot.multi.trees using DiagrammeR.
The text was updated successfully, but these errors were encountered: