/ai-platform-text-classifier-shap

Text classification demo from our Next '19 breakout session

Primary LanguageJupyter NotebookApache License 2.0Apache-2.0

Text classification model interpretability demo

This code is provided as example only. It is provided without guarantee or level of support. This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.

This is the demo I presented at my Cloud Next '19 talk with Yufeng. It shows how to build a bag of words text classification model to tag ML-related Stack Overflow questions, deploy the model to AI Platform, and interpret it's predictions with SHAP. For more details on the SHAP piece of this demo, see my blog post.

Architecture diagram

Running the notebook

To run the notebook, create a new Colab notebook and import the stackoverflow-classifier.ipynb file in this repo. The CSV we used for the Stack Overflow training data is public. You'll need to create a Google Cloud project to deploy the model. If you don't want to do that, you'll still be able to run the SHAP code at the end of the notebook.

Got any feedback? File an issue or ping me on Twitter at @SRobTweets

This is not an officially supported Google product.