parrt / dtreeviz

A python library for decision tree visualization and model interpretation.
MIT License
2.94k stars 331 forks source link

Explain leaf prediction path #278

Open tlapusan opened 1 year ago

tlapusan commented 1 year ago

Kind of similar with explain_prediction_path(x).

When looking at the tree structure (or leaf visualisations), you can observe some interesting nodes/leaves and you want to know what characteristics have all the training samples from that node. We can use the split values from the root until the interested node and build some similar output like in explain_prediction_path(x)

lchakkei commented 1 year ago

You can use view() to show the leaf prediction path e.g viz_model.view(x=X_testset[0]) image

tlapusan commented 1 year ago

Indeed, but it is not convenient/easy to find an x sample which belong to a specific leaf/node.

what I thought was something like 'explain_node_path(node_id=3)'

parrt commented 1 year ago

I guess that makes sense to me except I'm not sure how we know what the node id is. Do we have a way to display that?

tlapusan commented 1 year ago

I just put the mouse over a node and little pop-up appear with the node id. We could include also other info in this way.

Screenshot 2023-03-19 at 11 04 17
parrt commented 1 year ago

cool! Didn't know about that. kind of like the feature earlier we talked about where in leaf display we could pop up node id in bar chart, right?

tlapusan commented 1 year ago

yes, could be the same... but it's kind of a hidden functionality. The user has to know it upfront.