|
|
豪爽的豌豆 · 还在为玩不了ChatGPT苦恼?这十几个开源 ...· 2 月前 · |
|
|
知识渊博的铁链 · Debian10 安装Python3.9开发者社区· 2 月前 · |
|
|
卖萌的紫菜汤 · 如何从日期中获取微秒数?开发者社区· 1 月前 · |
|
|
大气的开心果 · JQuery操作Json循环插入到Table ...· 1 年前 · |
|
|
想出国的苦瓜 · SQL Server 数据库邮件超时语句 ...· 2 年前 · |
|
|
深情的单杠 · selenium webdriver ...· 2 年前 · |
|
|
玩篮球的煎鸡蛋 · TypeScript:类(Classes) ...· 3 年前 · |
|
|
健壮的野马 · Objective-C精选字符串处理方法 ...· 3 年前 · |
我使用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