【发布时间】:2018-01-25 13:04:50
【问题描述】:
我正在尝试显示树输出,但是当我运行下面的脚本时,我收到如下错误:
InvocationException:未找到 GraphViz 的可执行文件
我在这里搜索过类似的主题,但大多数都与 Mac 相关。我使用的是 Windows 10 64 位操作系统,我使用的是 Anaconda-3 64 位。我很想听听您对此的建议。
#Displaying the decision tree
from sklearn import tree
#from StringIO import StringIO
from io import StringIO
#from StringIO import StringIO
from IPython.display import Image
out = StringIO()
tree.export_graphviz(classifier, out_file=out)
import pydotplus
graph=pydotplus.graph_from_dot_data(out.getvalue())
Image(graph.create_png())
编辑:我再次安装了 graphviz 和 pydotplus 模块,但现在仍在工作。
【问题讨论】:
标签: python python-3.x anaconda graphviz decision-tree