My LSTM model has been trained well. Next step I will do is got a SHAP value and use It for model explainability. But I faced error.
The model output must be a vector or a single value!
I know output of LSTM model has 3d. Because I reshape my data from 2d to 3d. But I have no idea for this problem.
model3 = Sequential()
model3.add(LSTM(57, input_shape=(7, 57), return_sequences=True, activation='sigmoid'))
model3.add(dropout)
model3.add(Dense(1, activation='sigmoid'))
model3.compile(optimizer='adam', loss='binary_crossentropy', metrics=[tf.keras.metrics.Recall(), tf.keras.metrics.AUC(), tf.keras.metrics.Precision() ])
After fitting the model. I predicted X_test.
pred = model3.predict(X_test, batch_size=1, verbose = 1)
And then, I faced this error message.
explainer = shap.DeepExplainer(model3, X_train)
How can I solve this problem?