How can I extract decision tree's node in scikit-learn -


i want extract decision tree's detail information threshold, gini... when searched using google, can find information displaying barely no information node's information. gays know this?

you can export decision tree in dot format, , whatever want it, no 1 forces visualize it: link source code official documentation

from sklearn.datasets import load_iris sklearn import tree iris = load_iris() clf = tree.decisiontreeclassifier() clf = clf.fit(iris.data, iris.target)  open("iris.dot", 'w') f:     f = tree.export_graphviz(clf, out_file=f) 

iris.dot file contains:

digraph tree { node [shape=box] ; 0 [label="x[3] <= 0.8\ngini = 0.6667\nsamples = 150\nvalue = [50, 50, 50]"] ; 1 [label="gini = 0.0\nsamples = 50\nvalue = [50, 0, 0]"] ; 0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="true"] ; 2 [label="x[3] <= 1.75\ngini = 0.5\nsamples = 100\nvalue = [0, 50, 50]"] ; 0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="false"] ; 3 [label="x[2] <= 4.95\ngini = 0.168\nsamples = 54\nvalue = [0, 49, 5]"] ; 2 -> 3 ; .... } 

Comments

Popular posts from this blog

xml - Extract substrings with XSLT -

How can do a tuple comparison in coffeescript similar to that in python? -

math - "ELO Rating" and how does "TSR Rating" work? -