|
|
酷酷的熊猫 · 印尼官方回应中国游客巴厘岛遇害事件· 3 周前 · |
|
|
想表白的饼干 · mysql通过传入父级id查询所有子节点以及 ...· 10 月前 · |
|
|
内向的树叶 · 使用 GPT4 和 ChatGPT ...· 1 年前 · |
|
|
风度翩翩的眼镜 · el-tree ...· 1 年前 · |
|
|
爱笑的瀑布 · vue使用axios对后端接口发送post请 ...· 2 年前 · |
我使用Shap库来可视化变量的重要性。
我尝试将shap_summary_plot另存为'png‘图像,但我的image.png得到一个空图像
这是我使用的代码:
shap_values = shap.TreeExplainer(modelo).shap_values(X_train)
shap.summary_plot(shap_values, X_train, plot_type="bar")
plt.savefig('grafico.png')
代码起作用了,但是保存的图像是空的。
如何将绘图另存为image.png?
发布于 2019-09-18 14:36:53
我解决了这个问题。代码是:
shap_values = shap.TreeExplainer(modelo).shap_values(X_train)
shap.summary_plot(shap_values, X_train, plot_type="bar",show=False)
plt.savefig('grafic.png')
https://stackoverflow.com/questions/57976902
复制相似问题
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号: 粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
|
|
酷酷的熊猫 · 印尼官方回应中国游客巴厘岛遇害事件 3 周前 |