Shap: Time Series LSTM with SHAP

Created on 17 Oct 2019  路  2Comments  路  Source: slundberg/shap

Confused about the shap_values not equal to the model output and how the shap deepExplainer deal with the multi input of the lstm ?

A minimal for debugging:
https://github.com/oshapeman/lstm-shap/blob/master/shap_lstm_issue.ipynb

Thanks a lot !

Most helpful comment

When I ran your code I got no errors:

max: 1.260343674980291e-07
min: 1.1843082070583932e-10
mean: 1.4680117375043267e-08

But I am on my laptop without a GPU, so I had to change CuDNNLSTM to LSTM. It could be there is some issue with CuDNNLSTM.

To help find these problems in the future I have now added a check (turned on by default) that verifies the sum of the SHAP values equals the model's output in DeepExplainer.

All 2 comments

When I ran your code I got no errors:

max: 1.260343674980291e-07
min: 1.1843082070583932e-10
mean: 1.4680117375043267e-08

But I am on my laptop without a GPU, so I had to change CuDNNLSTM to LSTM. It could be there is some issue with CuDNNLSTM.

To help find these problems in the future I have now added a check (turned on by default) that verifies the sum of the SHAP values equals the model's output in DeepExplainer.

Thanks sir!
I also tested LSTM with shap, it worked as you showed. I think that it is a issue about the CuDNNLSTM when using shap.
Finally, thanks for your adding the check to the DeepExplainer, it helps a lot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

1vecera picture 1vecera  路  3Comments

shoaibkhanz picture shoaibkhanz  路  4Comments

TdoubleG picture TdoubleG  路  4Comments

samupino picture samupino  路  3Comments

saurabhhjjain picture saurabhhjjain  路  3Comments