运行代码时:
plot_tree(model)
我得到如下错误。
我该如何解决?
我怀疑这可能是安装graphviz软件包的问题,为此,我做了以下事情:
从以下位置安装Windows软件包 (https://graphviz.gitlab.io/_pages/Download/Download_windows.html)Install python graphviz软件包(使用anaconda提示“ pip install graphviz)
安装python graphviz软件包(使用anaconda提示“ pip install graphviz)
错误:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Traceback (most recent call last):
File “”, line 1, in
plot_tree(model)
File “C:\ProgramData\Anaconda3\lib\site-packages\xgboost\plotting.py”, line 278, in plot_tree
rankdir=rankdir, **kwargs)
File “C:\ProgramData\Anaconda3\lib\site-packages\xgboost\plotting.py”, line 227, in to_graphviz
graph = Digraph(graph_attr=kwargs)
File “C:\ProgramData\Anaconda3\lib\site-packages\graphviz\dot.py”, line 61, in __init__
super(Dot, self).__init__(filename, directory, format, engine, encoding)
TypeError: super(type, obj): obj must be an instance or subtype of type
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++