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

问题描述 投票:1回答:1

当我运行代码时:

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 installgraphviz)

  • 将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
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
python-3.x xgboost
1个回答
0
投票

您解决了吗?这个问题在我看来也很严重,我不知道如何解决]

© www.soinside.com 2019 - 2024. All rights reserved.