shap.force_plot() not working with TF 2.1

Created on 14 Mar 2020  路  3Comments  路  Source: slundberg/shap

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!

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)

All 3 comments

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!!!!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ArpitSisodia picture ArpitSisodia  路  3Comments

Nithanaroy picture Nithanaroy  路  4Comments

artemmavrin picture artemmavrin  路  4Comments

resdntalien picture resdntalien  路  3Comments

shoaibkhanz picture shoaibkhanz  路  4Comments