![]() |
Using SHAP Library for my LSTM model - "Attribute Error" - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Using SHAP Library for my LSTM model - "Attribute Error" (/thread-37722.html) |
Using SHAP Library for my LSTM model - "Attribute Error" - vatsalmtailor - Jul-13-2022 We used Keras to build our LSTM model as follows: import keras from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM #make LSTM model architecture model2 = Sequential() model2.add(LSTM(100, return_sequences = True)) model2.add(LSTM(50, return_sequences = True)) model2.add(LSTM(10)) model2.add(Dense(1)) model2.compile(loss='mae', optimizer='adam')The model builds, trains and predicts successfully but we face the following error when we use SHAP on the LSTM model: "Attribute Error": 'Deep' object has no attribute 'masker' The following is how we tried to use SHAP: import shap explainer = shap.DeepExplainer(model2,x_train_appended) shap_values = explainer(x_train_appended) And the following is the error received: Did anyone run into a similar issue when using SHAP Deep Explainer? Am I doing something wrong here? Any feedback is appreciated. Thanks a lot for your time and help in advance!
|