Hi! I'm porting over some code to TF 2.1 (from 1.14) with SHAP 0.35, and I'm hitting this issue with force_plot() that I don't hit with TF 1.14:
I get this error: TypeError: Object of type EagerTensor is not JSON serializable when I run this code:
shap.force_plot(shap_explainer.expected_value[0], shap_values[0], X_test[0:1], feature_names=feature_names).
Any help would be greatly appreciated!
Try calling .numpy() on the EagerTensor:
shap.force_plot(shap_explainer.expected_value[0].numpy(), shap_values[0], X_test[0:1], feature_names=feature_names)
Thank you!
Try calling
.numpy()on the EagerTensor:
shap.force_plot(shap_explainer.expected_value[0].numpy(), shap_values[0], X_test[0:1], feature_names=feature_names)
Thanks!!!!!!
Most helpful comment
Try calling
.numpy()on the EagerTensor:shap.force_plot(shap_explainer.expected_value[0].numpy(), shap_values[0], X_test[0:1], feature_names=feature_names)