使用Python计算和绘制SHAP交互值非常容易:https://h1ros.github.io/posts/explain-the-interaction-values-by-shap/或https://towardsdatascience.com/analysing-interactions-with-shap-8c4a2bc11c2a
我想在R中做同样的事情,最好使用kernelshap(计算SHAP值)和shapviz(可视化SHAP)包,但是,我很难找到计算SHAP交互值的等价物以及如何绘制它们--有人能帮忙吗?
1条答案
按热度按时间1rhkuytd1#
编辑
"shapviz"的开发版本现在包含
enter image description here

原始答案
您可以使用软件包"xgboost"和"treeshap"* 计算 * SHAP值(然后使用"ggplot2"等工具绘制它们)。
使用XGBoost的示例:
predict(..., predinteraction=TRUE)