Explaining GNNs with Captum
In this section, we will first introduce Captum and the integrated gradients technique applied to graph data. Then, we will implement it using a PyTorch Geometric model on the Twitch social network.
Introducing Captum and integrated gradients
Captum
(captum.ai) is a Python library that implements many state-of-the-art explanation algorithms for PyTorch models. This library is not dedicated to GNNs: it can also be applied to text, images, tabular data, and so on. It is particularly useful because it allows users to quickly test various techniques and compare different explanations for the same prediction. In addition, Captum
implements popular algorithms such as LIME and Gradient SHAP for primary, layer, and neuron attributions.
In this section, we will use it to apply a graph version of integrated gradients [4]. This technique aims to assign an attribution score to every input feature. To this end, it uses gradients with respect to the model’...