python - 如何在 Jupyter 中放大 XGBClassifier plot_importance 大小?
问题描述
在我的 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)
推荐阅读
- apache-spark - 如果列的数据类型为:String,是否可以在 Spark-JDBC 的“option(”partitionColumn“,”colname“)”中定义“partitionColumn”?
- javascript - 如何在 Mocha 中进行测试?
- google-oauth - google oauth2 发现返回错误的 token_endpoint
- ruby-on-rails - 如何使用 Ruby on Rails 使用 CSRF 令牌登录到第三方身份验证服务器?
- c++ - C++阅读句子
- java - 当第三个条目进入时,方法中的 for 循环被跳过。 JAVA
- mysql - MySQLi按另一列选择不同的顺序
- c# - 使用 C# 7.0 调试 dll 并在被只能在 VS2013 上运行的 LightSwitch 项目使用时从 VS 2017 构建
- python-3.x - python子命令cog文件
- python - 为什么我的代码不能在命令行中运行?