前提・実現したいこと
「Pythonではじめる機械学習」を参考にJupyter Notebookでプログラムを作っています。
決定木を可視化するプログラムを実装中に以下のエラーメッセージが発生しました。
発生している問題・エラーメッセージ
FileNotFoundError Traceback (most recent call last) ~\Anaconda3\lib\site-packages\graphviz\backend.py in run(cmd, input, capture_output, check, quiet, **kwargs) 157 try: --> 158 proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), **kwargs) 159 except OSError as e: ~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text) 774 errread, errwrite, --> 775 restore_signals, start_new_session) 776 except: ~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session) 1177 os.fspath(cwd) if cwd is not None else None, -> 1178 startupinfo) 1179 finally: FileNotFoundError: [WinError 2] 指定されたファイルが見つかりません。 During handling of the above exception, another exception occurred: ExecutableNotFound Traceback (most recent call last) ~\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj) 343 method = get_real_method(obj, self.print_method) 344 if method is not None: --> 345 return method() 346 return None 347 else: ~\Anaconda3\lib\site-packages\graphviz\files.py in _repr_svg_(self) 111 112 def _repr_svg_(self): --> 113 return self.pipe(format='svg').decode(self._encoding) 114 115 def pipe(self, format=None, renderer=None, formatter=None, quiet=False): ~\Anaconda3\lib\site-packages\graphviz\files.py in pipe(self, format, renderer, formatter, quiet) 136 out = backend.pipe(self._engine, format, data, 137 renderer=renderer, formatter=formatter, --> 138 quiet=quiet) 139 140 return out ~\Anaconda3\lib\site-packages\graphviz\backend.py in pipe(engine, format, data, renderer, formatter, quiet) 226 """ 227 cmd, _ = command(engine, format, None, renderer, formatter) --> 228 out, _ = run(cmd, input=data, capture_output=True, check=True, quiet=quiet) 229 return out 230 ~\Anaconda3\lib\site-packages\graphviz\backend.py in run(cmd, input, capture_output, check, quiet, **kwargs) 159 except OSError as e: 160 if e.errno == errno.ENOENT: --> 161 raise ExecutableNotFound(cmd) 162 else: 163 raise ExecutableNotFound: failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on your systems' PATH
該当のソースコード
Python
1from sklearn.tree import export_graphviz 2export_graphviz(tree, out_file="tree.dot", class_names=["malignant", "benign"],\ 3 feature_names=cancer.feature_names, impurity=False, filled=True) 4 5import graphviz 6with open("tree.dot") as f : 7 dot_graph = f.read() 8graphviz.Source(dot_graph)
試したこと
補足情報(FW/ツールのバージョンなど)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/09/15 01:33