SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Algorithm 2 Sampling Fake Explanatory Subgraphs for General Evaluation
Input: Dataset  $\mathcal{D} = \{\mathcal{G}^1,\mathcal{G}^2,\dots ,\mathcal{G}^N\}$  ; Number of Recall levels  $N_{L}$  ; Number of sampled subgraphs per graph  $N_{sub}$  Size of sampled subgraph  $K_{sub}$    
Output: Pairs of Recall level and corresponding subgraphs  $(L_{k},\{G_{s,k}^{i,j}\mid i = 1,2,\ldots ,N;j =$ $1,2,\ldots ,N_{sub}\})$ $k = 1,2\dots ,N_L$    
1: for  $k = 1,2,\ldots ,N_L$  do   
2:  $L_{k}\gets \frac{k - 1}{N_{L} - 1}$    
3: for  $i = 1,2,\ldots ,N$  do   
4:  $K^{GT}\gets$  the number of edges in the ground-truth explanation of  $\mathcal{G}^i$    
5:  $K_{pos}\gets \lfloor L_k\times K^{GT}\rfloor$    
6:  $K_{neg}\gets K_{sub} - K_{pos}$    
7: for  $j = 1,2,\ldots ,N_{sub}$  do   
8:  $\mathcal{G}_{s,k}^{i,j}\gets$  a connected subgraph, randomly sampled from  $\mathcal{G}$  with  $K_{pos}$  edges in the ground truth explanation and  $K_{neg}$  edges not in it.   
9: end for   
10: end for   
11: end for
B Experimentals
B.1 Experimental Details
All experiments are conducted on a Linux machine with 8 NVIDIA GeForce RTX 3090 (24 GB) GPUs. CUDA version is 11.6 and Driver Version is 510.39.01. All codes are written under Python 3.9.13 with PyTorch 1.13.0 and PyTorch Geometric (PyG)[65] 2.2.0. We adopt the Adam optimizer throughout all experiments.
Overall, for each dataset, a target GNN classification model is well-trained first. Then the explainers are built on the GNN and generate explanations for its prediction on the dataset. After that, the explanation evaluation methods evaluate how well the explanations are. Our work stands at the last level.
Study Cases from MNIST-sp
class	Original Graph	High Quality	Human Intuition	Low Quality
Explanation 1	Explanation 2	Explanation 3	Explanation 4	Explanation 5
2	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE
3	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE
4	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE
5	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE
6	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE	OAR SimOAR RM DSE
Figure 5: Study cases. For each row, the explanations are ranked based on average rankings given by volunteers. Highlighted evaluation method below each explanation means that the method has given the explanation the highest score compared to other explanations in that row. Best viewed in color.
Target GNNs. GNNs have garnered significant recognition for their prowess in encoding graph data [37, 66, 67, 34, 58]. Amidst the vast landscape of GNNs, GIN [67] distinguishes itself with its superior encoding aptitude. In sight of this, the target GNNs for BA3, TR3, and Mutagenicity have the same structure, which is a two-layered GIN followed by a two-layered MLP with 32 hidden channels. They are trained with max epochs equal to 20, 200, and 200 respectively, batch size equal to 128, and learning rate equal to 0.001. The target GNN for MNIST-sp is adapted from an example code<sup>1</sup> provided by PyG, trained with the number of epochs equal to 20, batch size equal to 64, and initial learning rate equal to 0.01. Before training, we randomly split BA3, TR3, and Mutagenicity into train and test sets with ratios of  $90\%$  and  $10\%$ , respectively, while adopting the split provided by PyG for MNIST-sp. During training, we reserve data of the same size as the test set from the train set as the validation set and save the model which reaches the highest classification accuracy on the validation set for later use.
Explainers. We have implemented six state-of-the-art post-hoc explainers, namely, SA, GradCAM, GNNExplainer, PGExplainer, CXPlain, and ReFine, as claimed in Section 3.1, to generate explanatory subgraphs. Here we give a brief introduction to them:
- SA [10] captures the gradients w.r.t. adjacency matrix of the input features in the process of backpropagation and directly treats them as the importance scores.
- GradCAM [42] takes one step further over SA via improving the gradients w.r.t. the input features like edges by using context within the graph convolutional layers.
- GNNExplainer [11] directly learns an adjacency matrix mask by maximizing the mutual information between a GNN's prediction and distribution of possible subgraph structures.
- PGExplainer [43] adopts a deep neural network to parameterize the generation process of explanations, which makes it a natural approach to explaining multiple instances collectively.
<sup>1</sup>Reference code for the target GNN of MNIST-sp: https://github.com/pyg-team/pytorch/geometric/blob/89a54d9454d3832f814f9a574ed421c58f1fce10/examples/mnist_voxel_grid.py
Table 3: Average consistency scores of different evaluation metrics (corresponding to Table 1 in the main paper).
SHAPEGGEN	TR3	MUTAG	MNIST	BA3
GEF	0.800	0.734	0.800	0.934	0.734
SimOAR	0.800	0.867	0.800	0.934	0.934
OAR	0.867	0.934	1.000	0.934	1.000
Table 4: Correlation between metrics and Recall across explanatory subgraphs in four node classification datasets in [11] (corresponding to Figure 3 (a) in the main paper).
BA-Shapes	BA-Community	Tree-Cycles	Tree-Grid
RM	0.312	0.321	0.295	0.411
DSE	0.406	0.377	0.343	0.384
OAR	0.542	0.560	0.489	0.440
SimOAR	0.527	0.535	0.471	0.431
- CXPlain [44] treats the explanations as a causal learning task and trains causal explanation models that learn to estimate to what degree certain inputs cause outputs in the to-be-explained model.
- ReFine [39] leverages the pre-training explanations to exhibit global explanations and the fine-tuning explanations to adapt the global explanations in the local context.
The default hyper-parameters suggested by those papers are adopted, as whether the explainers are at their optimal state is secondary to our work. Among these explainers, SA, GradCAM, and GNNExplainer directly take the to-be-explained graph as input, while the rest three need to be trained on a set of graphs, i.e., the train set in our case, in advance. We only use the explanations extracted from graphs in the test set for evaluation.
Evaluation Methods. Finally, we arrive at the explanation evaluation level. There are four evaluation methods, i.e., removal-based evaluation, DSE, OAR, and SimOAR, to be considered. Removal-based evaluation directly feeds the explanatory subgraph into the target GNN and gets its prediction, on the predicted class of the original graph, as the evaluation score, which does not involve any details. For DSE, we make use of its public source code<sup>2</sup> and follow its paper to set hyper-parameters. As for our method OAR/SimOAR, we have summarized the entire process of OAR in Algorithm 1. Here we present more details on how the VGAE is trained. The encoder involves two two-layered GCNs for obtaining  $\mu$  and  $\sigma$ , each of which is realized with hidden channels equal to 256 and output channels equal to 128, while the two GCNs share the first layer. The dataset split process is the same as the training of the target GNNs. We train the VGAE model on the train set with the number of epochs equal to 100, batch size equal to 256, and learning rate equal to 0.001. The model that reaches the lowest loss on the validation set is saved for later OOD reweighting.
B.2 More Quantitative Results
Here, we sequentially present the experimental results of 1) comparison between GEF [49] and our metrics w.r.t the latest dataset SHAPEGGEN and the other datasets (Table 3), 2) correlation between metrics and Recall across explanatory subgraphs in four node classification dataset (Table 4), and 3) correlation between metrics and Recall while evaluating the explanations generated by the inherent explainable GNN, GSAT [15] via introducing an additionally well-trained GIN [67] as the model  $f$  in Algorithm 1 (Table 5).
Note that while evaluating explanations in node classification tasks, for each node in the input graph, we construct an ego graph for it based on the number of layers in the baseline GNN. Then, the explanation task for node classification can be transferred to the explanation task for graph classification. Furthermore, the remaining hyperparameters and methods in our OAR/SimOAR remain unchanged.
Source code of DSE: https://anonymous.4open.science/r/DSE-24BC/
Table 5: Correlation between metrics and Recall while evaluating the explanations generated by the inherent explainable GNN, GSAT (corresponding to Figure 3 (a) in the main paper).
BA3	MUTAG	TR3	MINST
RM	0.376	0.381	0.402	0.337
DSE	0.411	0.425	0.417	0.319
OAR	0.613	0.590	0.585	0.606
SimOAR	0.598	0.572	0.552	0.581
C User Study
In order to measure the consistency between evaluation results and human intuition, we organized a large-scale user study engaging 100 volunteers. Each volunteer was asked to check 5 groups of graphs, which contain an instance from MNIST-sp, its predicted class, and 5 randomly sampled subgraphs from this instance, and try to rank these 5 subgraphs according to how well they serve as explanations of the prediction based on intuition. We exhibit partial results in Figure 5. According to these results we can find that our evaluation methods i.e. OAR and SimOAR show the highest consistency with human intuition.