tree graph
This commit is contained in:
parent
d91b9141fc
commit
f3b42cef6a
@ -41,4 +41,14 @@ y = df['Decision']
|
|||||||
dtree = DecisionTreeClassifier()
|
dtree = DecisionTreeClassifier()
|
||||||
dtree = dtree.fit(X, y)
|
dtree = dtree.fit(X, y)
|
||||||
|
|
||||||
|
data = tree.export_graphviz(dtree, out_file=None, feature_names=features)
|
||||||
|
graph = pydotplus.graph_from_dot_data(data)
|
||||||
|
graph.write_png('mydecisiontree.png')
|
||||||
|
|
||||||
|
img = pltimg.imread('mydecisiontree.png')
|
||||||
|
imgplot = plt.imshow(img)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#print(dtree.predict([[0, 1, 0, 0, 0, 1]]))
|
#print(dtree.predict([[0, 1, 0, 0, 0, 1]]))
|
Loading…
Reference in New Issue
Block a user