python-Xgboost可视化问题 You must install graphviz to plot tree

xgboost

代码

# plot decision tree
from numpy import loadtxt
from xgboost import XGBClassifier
from xgboost import plot_tree
import matplotlib.pyplot as plt
from graphviz import Digraph
# load data
import pydot

# print pydot.find_graphviz()

dataset = loadtxt('pima-indians-diabetes.csv', delimiter=",")
# split data into X and y
X = dataset[:, 0:8]
y = dataset[:, 8]
# fit model no training data
model = XGBClassifier()
model.fit(X, y)
# plot single tree
plot_tree(model)
plt.show()

遇到问题
You must install graphviz to plot tree

解决办法
1. https://pypi.python.org/pypi/graphviz/0.3.3
2. pip install graphviz

Here is the web page of that graphviz. This is a python package called
graphviz. Bad choice of name. You need to install the c version of
graphvis. See this web page:

https://pypi.python.org/pypi/graphviz/0.3.3

From the command line, the command “dot” should work. Look into you OS to
know if it provide graphviz. If so, it will be probably the c version.

Fred

参考资料:
- https://github.com/Theano/Theano/issues/1801

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值