xgboost plot_tree(model)-运行时修复TypeError:super(type,obj)

时间:2019-03-28 02:03:46

标签: python-3.x xgboost

运行代码时:

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)

  • 将C:\ Program Files(x86)\ Graphviz2.38 \ bin添加到用户路径
  • 将C:\ Program Files(x86)\ Graphviz2.38 \ bin \ dot.exe添加到系统路径

错误:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

0 个答案:

没有答案