2

我尝试使用python 中的这个包示例来解释我的深度学习模型。shap

当我调用 时explainer.shap_values(test[:2]),我得到一个 Keyerror - ClipByValue。

显然 ClipByValue 不存在于我的tf_ops._gradient_registry._registry.

4

1 回答 1

2

我今天也遇到了这个问题。

在我的调查中,我已经在 Shap 中隔离了这个问题。v0.19.3 版本工作正常,但 v0.19.4 版本不是因为 ClipByValue 不存在 - 而且,对于标签 V0.19.3,ClipByValue 未列在非线性中:https ://github.com/slundberg/shap /blob/V0.19.3/shap/explainers/deep.py#L44。因此,看起来这个特定示例从未与 ClipByValue 包含在所述数组中一起使用。

为了解决这个问题,我将 requirements.txt 中的 shap==v0.21.0 替换为

-e git://github.com/slundberg/shap.git@48bc3a7f8fa9465be778ecef14d4de8604275f7f#egg=shap

然后,在我的 python virtualenv 中,导航到克隆的文件夹,签出一个新分支,然后将标签 V0.19.3 的 deep.py 版本粘贴到当前存在的内容之上。虽然有点黑客...

不确定如何正确解决此问题。

于 2018-08-03T05:11:33.107 回答