gpt4 book ai didi

python - 如何在 Jupyter 中扩大 XGBClassifier plot_importance 大小?

转载 作者:太空宇宙 更新时间:2023-11-04 09:41:22 25 4
gpt4 key购买 nike

在我的 Jupyter 笔记本中,我有:

from xgbost import plot_importance

plot_importance(model)
pyplot.show()

由于模型有很多特征,输出图表不可读。如何使图表变大?

最佳答案

您可能想要创建图形以绘制到 xgboost 绘图函数的外部。这将允许您将大小设置为您喜欢的任何大小。

fig, ax = plt.subplots(figsize=(10,8))
plot_importance(model, ax=ax)

或者,您可以让绘图函数创建您拥有的图形,然后更改其大小。

ax = plot_importance(model)
ax.figure.set_size_inches(10,8)

关于python - 如何在 Jupyter 中扩大 XGBClassifier plot_importance 大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51546340/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com