[英]Python Jupyter notebook SHAP force_plot, how to change the background color or text color in the dark theme?
添加matplotlib=True
的参数后,问题解决。
shap.force_plot(explainer.expected_value[1], shap_values[1][0,:], X_test.iloc[0,:],link="logit", matplotlib=True)
该图似乎是在 html 文件上使用 matplotlib 创建的。
为了正确绘图,首先我在 Jupyter notebook 的深色模型中使用了style.use('seaborn-dark')
。
一种解决方法是将图形导出为 html 文件,然后在浏览器中打开它:
p = shap.force_plot(explainer.expected_value[1], shap_values[1][0,:], X_test.iloc[0,:],link="logit")
shap.save_html('my_force_plot.html', p)
但我猜浅色方案也可以规避这个问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.