scikit-learn/scikit-learn

Changing the label order in export_graphviz for interpretability

Open

#7.774 geöffnet am 27. Okt. 2016

Auf GitHub ansehen
 (2 Kommentare) (2 Reaktionen) (0 zugewiesene Personen)Python (27.020 Forks)batch import
Enhancementhelp wantedmodule:tree

Repository-Metriken

Stars
 (66.084 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 10T) (90 gemergte PRs in 30 T)

Beschreibung

Description

I occasionally present results to experimental folks, who really love decision tree models due to their interpretability. For informal meetings, I often use the export_graphviz function to create the decision tree viz and talk them through the results. However, I noticed that they are often confused about the labels in the node. I.e., what's in that node vs. what's the splitting criterion. "Do these samples at this node have a feature value x <= y?", "no, this would be the splitting criterion to produce the following child nodes"

Although, it should be somewhat clear from looking at the first node that the first line with the feature name refers to the splitting criterion, maybe it would be worthwhile swapping the order? This way the statistics in the node apply to the samples in this actual node, and the last line (the splitting criterion) would refer to the two child nodes going off from the parent node.

Or in simpler words, what do you think about putting the splitting criterion at the bottom of a node?

screen shot 2016-10-27 at 7 28 27 pm

And maybe even putting a divider line in-between?

screen shot 2016-10-27 at 7 50 35 pm

Contributor Guide