I am try to explain my deep learning model using this example of shap
package in python.
When I call the explainer.shap_values(test[:2])
, I am getting an Keyerror - ClipByValue.
Apparently ClipByValue is not present in my tf_ops._gradient_registry._registry
.
I too came across this issue today.
In my investigations, I've isolated this issue within Shap. The v0.19.3 release works fine, but the v0.19.4 release does not due to ClipByValue being not present - and, for tag V0.19.3, ClipByValue is not listed amongst the nonlinearities: https://github.com/slundberg/shap/blob/V0.19.3/shap/explainers/deep.py#L44 . So it looks like this particular example has never worked with ClipByValue being included in said array.
To work around this issue, I replaced shap==v0.21.0 in my requirements.txt with
-e git://github.com/slundberg/shap.git@48bc3a7f8fa9465be778ecef14d4de8604275f7f#egg=shap
and then, in my python virtualenv, navigated to the cloned folder, checked out a new branch, and then pasted the version of deep.py for tag V0.19.3 on top of what was presently there. A bit of a hack though ...
Not sure how one would resolve this properly.