繁体   English   中英

Python Jupyter notebook SHAP force_plot,如何更改深色主题中的背景颜色或文字颜色?

[英]Python Jupyter notebook SHAP force_plot, how to change the background color or text color in the dark theme?

在此处输入图片说明

有什么方法可以更改深色主题中的形状图背景颜色或文本颜色? 我需要白色背景或白色文本。

该图是 IPython.core.display.HTML 的一个对象。

它是由

shap.force_plot(explainer.expected_value[1], shap_values[1][0,:], X_test.iloc[0,:],link="logit")

谢谢您的帮助!

添加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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM