tree graph

This commit is contained in:
secret_dude 2021-05-19 05:04:00 +02:00
parent d91b9141fc
commit f3b42cef6a

View File

@ -41,4 +41,14 @@ y = df['Decision']
dtree = DecisionTreeClassifier()
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]]))