繁体   English   中英

Azure Data Studio中Shap渲染

[英]Shap rendering in Azure Data Studio

我无法在 Azure Data Studio 笔记本中运行 shap.initjs()。 放弃在 Azure 社区论坛或其他地方查找问题。

省略可视化,未加载 Javascript 库!

shap.initjs()
test_sample = test_x.iloc[:2000,:]
shap_values_sample = explainer.shap_values(test_sample)
shap.force_plot(explainer.expected_value[1], shap_values_sample[1], test_sample, link="logit")

我得到了 Databricks 的解决方案。 您只需要从 force_plot 中获取 HTML 并使用 displayHTML 来查看 force_plot。 尝试这个:

force_plot = shap.force_plot(xgb_explainer.expected_value, xgb_shap_values, X_test, matplotlib=False)
shap_html = f"<head>{shap.getjs()}</head><body>{force_plot.html()}</body>"
displayHTML(shap_html)

更多信息: https://towardsdatascience.com/tutorial-on-displaying-shap-force-plots-in-python-html-4883aeb0ee7c

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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