安装:
pip install graphviz
pip install pydotplus
yum install graphviz
from xgboost import XGBClassifier
clf = XGBClassifier(learning_rate=0.001)
clf.fit(x_data.toarray(),label_lst,eval_metric="logloss",eval_set=[(x_data,label_lst)],verbose=True)
from xgboost import plot_tree
import matplotlib.pyplot as plt
plot_tree(clf)
这样就实现了xgboost的可视化模型
本文详细介绍如何使用Python的XGBoost库进行模型训练,并通过Graphviz和Matplotlib实现决策树的可视化展示,帮助理解模型结构。

1669

被折叠的 条评论
为什么被折叠?



