【发布时间】:2021-05-27 18:54:32
【问题描述】:
我的代码:
from IPython.display import Image
from sklearn.externals.six import StringIO
import pydotplus
dot_data = StringIO()
tree.export_graphviz(clf, out_file=dot_data,
feature_names=list(features.columns.values))
graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
Image(graph.create_png())
错误:
---------------------------------------------------------------------------
InvocationException Traceback (most recent call last)
<ipython-input-11-35d87411c12d> in <module>
7 feature_names=list(features.columns.values))
8 graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
----> 9 Image(graph.create_png())
~\.conda\envs\myTensorflow\lib\site-packages\pydotplus\graphviz.py in <lambda>(f, prog)
1789 self.__setattr__(
1790 'create_' + frmt,
-> 1791 lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
1792 )
1793 f = self.__dict__['create_' + frmt]
~\.conda\envs\myTensorflow\lib\site-packages\pydotplus\graphviz.py in create(self, prog, format)
2024 raise InvocationException(
2025 'Program terminated with status: %d. stderr follows: %s' % (
-> 2026 status, stderr_output))
2027 elif stderr_output:
2028 print(stderr_output)
InvocationException: Program terminated with status: 1. stderr follows: 'C:\Users\NEO' is not recognized as an internal or external command,
operable program or batch file.
我还需要做什么?需要任何库或包吗?
【问题讨论】:
-
不是
artificial-intelligence问题,请不要发送垃圾邮件无关标签(已编辑)。
标签: python scikit-learn decision-tree pydot pydotplus