决策树Python 3.5程序
from IPython.display import Image
from sklearn import tree
import pydotplus
from pydotplus import graphviz
dot_data = tree.export_graphviz(clf, out_file=None,
feature_names=iris.feature_names,
class_names=iris.target_names,
filled=True, rounded=True,
special_characters=True)
graph = pydotplus.graphviz.graph_from_dot_data(dot_data)
Image(graph.create_png())
运行出现“AttributeError: 'NoneType' object has no attribute 'write'”