# How to interpret scikit learn classification tree?

I'm currently trying to work with scikit-learn classification tree.

I followed the example on iris dataset : http://scikit-learn.org/stable/modules/tree.html and everything is working fine.

I do not understand the final graph though. My problem is that values like [50, 0, 0] are not clear to me. Which values corresponds to which class ? I mean, if I shuffle the lines of the dataset, class 0,1,2 will not be in the same order so my tree values will change.

So does anybody knows how I could change the code in order to have the proper initials labels before the values (and if possible how to plot the proportions for each leaf ?)

Thanks,

PS : If you feel that this question is too scikit-learn based. Please edit it so it is sent to stack overflow instead.

Either the unique string name or integer identifier for each class is stored in the classes_ attribute of the DecisionTreeClassifier instance after a call to the fit method.
• Then just have a look at the source code of the export_graphviz function and customize it to have it work the way you want. Jan 8 '14 at 12:39