I am getting the following error when using the DeepExplainer for the Keras sequential model for Multiclass text classification. Please find the details below:
##KERAS VERSION: 2.4.3.
##MODEL
model = Sequential()
model.add(InputLayer (input_shape= (max_len ,)))
model.add(Embedding (vocab_size +1 , embed_dim , input_length= max_len, weights[embed_matrix]))
model.add(LSTM (LSTM_unit , dropout= dropouts, recurrent_dropout=dropouts,return_sequences=False))
model.add(Dense (6 , activation="softmax"))
##DEEPEXPLAINER
explainer = shap.DeepExplainer(model, X_train[:100], learning_phase_flags = None)
shap_values = explainer.shap_values(X_test[:10])
ERROR
LookupError: gradient registry has no entry for: shap_TensorListStack
Please help me with the solution to this issue. I have tried all the possible solutions provided in the issues mentioned in the repository but couldn't able to solve this error.
Best Regards, Meghna Goyal
This error is due to the "shap" package that you are using. It requires a specific set of packages to work:
Ref: https://github.com/slundberg/shap/issues/1490#issuecomment-1368185975