I am trying to build a recommendation model using TensorFlow recommender and Keras.
I am trying to get model explainability using SHAP library, however, I am facing an issue as I have sub class keras model
` I am using the example https://www.tensorflow.org/recommenders/examples/multitask'
import shap
background = train_np[np.random.choice(train_np.shape[0], 100, replace=False)]
explainer = shap.DeepExplainer(model, background)
i am getting an error when running Shap
frames/usr/local/lib/python3.7/dist-packages/shap/explainers/tf_utils.py in _get_model_output(model) 83 isinstance(model, tf.keras.Model): 84 if len(model.layers[-1]._inbound_nodes) == 0: ---> 85 if len(model.outputs) > 1: 86 warnings.warn("Only one model output supported.") 87 return model.outputs[0] TypeError: object of type 'NoneType' has no len()
Any suggestions ?