Tools for interpretability
1. Tools for interpretability
We discussed many interpretability techniques. Now let's look into useful tools to apply these techniques to your machine learning models. We are going to look at three tools; open source libraries, SHAP and saliency, learning interpretability tool, an open source platform for visualization and understanding of models and vertex explainable AI, a Google Cloud solution for post-hoc explanations. First, SHAP Python Library provides popular implementations of approximate Shapley values including sampled Shapley, Kernel SHAP, Tree SHAP and so on. It's a post hoc technique that generates explanations for individual predictions that can also be aggregated for global model feature importances, onctangular and text data. SHAP's biggest drawback is its computational cost on large feature sets that have limited its application to domains such as images. Next is saliency. Google's people and AI research team or pair team, offers a Saliency Python library that mainly covers gradient-based explanation techniques including integrated gradients, XRAI, and a lot of their variants. The learning interpretability tool or LIT is for researchers and practitioners who want to understand model behavior through a visual, interactive, and extensible tool. It mainly supports natural language processing or NLP with some preliminary support for tabular and image data. You can use LIT to ask and answer questions such as, what kind of examples does my model perform poorly on? Why did my model make this prediction? Does the model properly focus on important features instead of obviously unimportant features like image background? Does my model behave consistently if I change things like textual style, verb tense, or pronoun gender? Does this method relate to counterfactual analysis in AI fairness and bias? LIT has lots of functionalities and it even provides you with the ability to add custom techniques, metrics, visualizations, and more. You can also customize the layer itself to select your modules and groups of interest. Let's get a general overview of the UI to get a feel of what capabilities it offers. LIT is divided into two workspaces. A main workspace in the upper half of the interface and a group-based workspace in the lower half. Each workspace is a logical combination of groups each containing different modules. This allows you to view different visualizations and methods side by side. LIT supports many models and features. Models like classification, regression, sequence to sequence, etc and features like an embedding projector, TCAV, counterfactual analysis, etc. Two of the most important features to mention are token-based input salience methods and pixel-based salience methods. Token-based input salience methods include gradient-based methods and black box techniques like line. Pixel-based salience methods are used for models that take images as inputs. The output for both types of salience methods is rendered in the Salience maps module in the LIT UI which allows for comparison of multiple methods at once. Vertex Explainable AI is Google Cloud managed service for interpretability. It offers feature-based and example-based explanations to provide better understanding of model decision making even for complex models. With example-based explanations, vertex AI uses nearest neighbor search to return a list of examples, typically from the training set that are most similar to the input. It currently supports only TensorFlow models that can provide an embedding or latent representation for inputs. With feature-based explanations, vertex AI uses sampled sharply, integrated gradients or XRAI. It works on tabular, image, video, and text data. It currently supports all types of models such as AutoML, BQML models, and custom trained models on vertex AI and frameworks like TensorFlow, scikit-learn, and XG Boost for BigQuery ML and AutoML. Google Cloud provides simple ways to look at predictions within the product. BigQuery ML provides five different AI explanation functions that you can use in SQL. For AutoML, you can simply access explanations from the test and use tab, select and configure the prediction type you want, and get explanations. In the screenshot here you are seeing an example of online prediction for text data with samples sharply for local feature importance. Global importance is also supported. On vertex I it is also easy to set up explanations. This is an example to configure it from the console. But remember that you can also set them up for gcloud CLI, REST and Python. All you need to do is import the model and model registry and configure your desired explanations in the Explanability tab.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.