Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cell #31 ValueError master/sample/nlp-model_interpretation_shap.ipynb #10

Open
GDBSD opened this issue Aug 22, 2020 · 0 comments
Open

Comments

@GDBSD
Copy link

GDBSD commented Aug 22, 2020

explainer = shap.DeepExplainer(pipeline.model, encoded_x_train[:10])
shap_values = explainer.shap_values(encoded_x_test[:1])

x_test_words = prepare_explanation_words(pipeline, encoded_x_test)
y_pred = pipeline.predict(x_test[:1])
print('Actual Category: %s, Predict Category: %s' % (y_test[0], y_pred[0]))

shap.force_plot(explainer.expected_value[0], shap_values[0][0], x_test_words[0])

RETURNS:

ValueError: Dimensions must be equal, but are 10 and 100 for '{{node gradient_tape/functional_1/global_max_pooling1d/truediv_1}} = RealDiv[T=DT_FLOAT](gradient_tape/functional_1/global_max_pooling1d/sub_1, gradient_tape/functional_1/global_max_pooling1d/sub)' with input shapes: [10,512], [10,100,512].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant