Explaining transformers using SHAP
In this chapter, so far we have seen examples of various SHAP explainers used to explain different types of models trained on structured and image datasets. Now, we will cover approaches to explain complicated models trained on text data. For text data, getting high accuracy with models trained on conventional Natural Language Processing (NLP) methods is always challenging. This is because extracting contextual information in sequential text data is always difficult using the classical approaches.
However, with the invention of the Transformer deep learning architecture (https://blogs.nvidia.com/blog/2022/03/25/what-is-a-transformer-model/), which is based on an attention mechanism, obtaining higher accuracy models trained on text data became much easier. However, transformer models are extremely complicated and it can be really difficult to interpret the workings of such models. Fortunately, being model-agnostic, SHAP can be applied with transformer...