Parameterized Explainer for Graph Neural Network

Overview

PGExplainer

This is a Tensorflow implementation of the paper: Parameterized Explainer for Graph Neural Network

https://arxiv.org/abs/2011.04573

NeurIPS 2020

Requirements

  • Python 3.6.8
  • tensorflow 2.0
  • networkx

References

@article{luo2020parameterized,
  title={Parameterized Explainer for Graph Neural Network},
  author={Luo, Dongsheng and Cheng, Wei and Xu, Dongkuan and Yu, Wenchao and Zong, Bo and Chen, Haifeng and Zhang, Xiang},
  journal={Advances in Neural Information Processing Systems},
  volume={33},
  year={2020}
}

Pytorch Implementation

Here are several re-implementations and reproduction reports from other groups. Thanks very much these researchers for re-implementing PGExplainer to make it more easy to use!

  1. [Re] Parameterized Explainer for Graph Neural Network

https://zenodo.org/record/4834242/files/article.pdf

Code:

https://github.com/LarsHoldijk/RE-ParameterizedExplainerForGraphNeuralNetworks

Note that in this report, they adopt different GCN models with our implementation.

  1. Reproducing: Parameterized Explainer for Graph NeuralNetwork

https://openreview.net/forum?id=tt04glo-VrT

Code:

https://openreview.net/attachment?id=tt04glo-VrT&name=supplementary_material

  1. DIG

https://github.com/divelab/DIG/tree/main/dig/xgraph/PGExplainer

Comments
  • About the readout operation in graph classification

    About the readout operation in graph classification

    Dear author,

    I hit upon that it seems like the global pooling operation in graph classification is on the wrong axis. For example, when reading out the "out" ( graph_num, node_size, fea_num) with axis=-1, the resulting shape is (graph_num, node_size) but not the desired (graph_num, fea_num).

    opened by Radical3-HeZhang 10
  • Got NaN output when running BA-shapes.ipynb

    Got NaN output when running BA-shapes.ipynb

    Hi

    I attempt to run the code in "BA-shapes.ipynb" and got an error "ValueError: Input contains NaN, infinity or a value too large for dtype('float32')". Only "BA-shapes.ipynb" has this issue. The other three experiments are fine. I think this may be caused by the python environment. Could you please provide your environment for running experiments?

    Here is my output of running "BA-shapes.ipynb" and "pip freeze": https://gist.github.com/haolanut/814d3908fd4a91fd37da22b0349269cc

    Also, I'm wondering are you planning to provide the script for explaining the graph classification model?

    Thank you!

    opened by haolanut 9
  • Reproduce the results for Graph Classification

    Reproduce the results for Graph Classification

    Dear author, may I know when you will release the complete code for explaining GNN for graph classification tasks?

    We have some difficulties in reproducing the experimental results in your paper. In particular, we have the following questions

    Questions: 1: For the dataset MUTAG, do you use any node features when training the GNN model for graph classification tasks? And did you use the batch norm layer in the GNN model? If yes, what is the batch size?

    2: When you calculate the AUC, how do you know the ground truth for explaining the GNN model for graph classification tasks? And when training the explainer, do you use the entire dataset, including both classes, or only use the mutagen graphs.

    opened by wanyu-lin 8
  • BA-2Motifs

    BA-2Motifs

    Hi,

    Really cool project. I was wondering if you had plans to release the BA-2Motifs datasets as well. At the moment it is the missing from the datasets folder, and if you would be able to provide more details on the hyper-parameter choices you have made in the graph classification models.

    While I looked at the appendix, I see that there are additional options in the model definition including (Batchnorm, Concatenating an add pool option etc).

    I'm trying to replicate your results in Pytorch/ Pytorch Geometric for the graph classification set-ups.

    Thanks!

    opened by pindapuj 5
  • The loss in the code is not the same as in the paper

    The loss in the code is not the same as in the paper

    the loss in the paper is: image but in code: image you just take out the probability of the item corresponding to the label,and use -tf.math.log() to get the pred_loss,$\sum_{c=1}^C$ I don't think it shows up in code.

    opened by hcn323 1
  • About the number of samples K in the paper.

    About the number of samples K in the paper.

    Hi,

    Really cool project. When I compared this implementation with the one decribed in the paper, I found out that this code does not sample K times for each node's subgraph. Is there any reason for it and will it leads to a high variance for a certain node?

    Looking forward to your response!

    Thanks!

    opened by guyguygang 1
  • AUC calculation

    AUC calculation

    Why the mean auc score calculated in BA-shapes.ipynb is about 99%. I also tried all nodes from three classes in house motif, the auc score is still around 99%. And that performs quite better than the 0.963±0.011 score you presented in the paper. Are the calculations of auc score different?

    opened by gui-li 1
  • PGexplainer is weak against graphs with mean degree greater than 1000

    PGexplainer is weak against graphs with mean degree greater than 1000

    Hello. How are you? I'm investigating PGexplainer and I noticed that it is incredibly weak at explaining graphs with nodes with more than 1000 neighbors. An example is the bitcoin-alpha and -otc dataset. PGexplainer (with 3hop) does not achieve 1% explanation accuracy. For 1hop (average degree 17), PGexplainer achieves ~83% accuracy. Why does this occur?

    Another point is the explanation time which is said to outperform GNNexplainer, however, for cases with nodes with degree greater than 1000, PGexplainer is much slower than GNNexplainer. Why does this occur?

    opened by ErikJhones 0
  • Disconnected motifs in BAMotifs

    Disconnected motifs in BAMotifs

    Hello,

    I was playing around with train_BA-2motif.ipynb when I realized that some input graphs are not as expected. Specifically, by running this code after the cell where you read the dataset:

    for i in adjs:
        d = nx.from_numpy_array(i)
        if not (nx.is_connected(d)):
            nx.draw(d)
            plt.show()
    

    I saw that there are about 40 graphs that are disconnected and in which the target motif has a self-loop. This behavior is unexpected after reading the dataset description of the original paper.

    image

    opened by steveazzolin 2
Owner
Dongsheng Luo
Ph.D. Student @ PSU
Dongsheng Luo
A Python type explainer!

typesplainer A Python typehint explainer! Available as a cli, as a website, as a vscode extension, as a vim extension Usage First, install the package

Typesplainer 79 Dec 1, 2022
Orthogonal Over-Parameterized Training

The inductive bias of a neural network is largely determined by the architecture and the training algorithm. To achieve good generalization, how to effectively train a neural network is of great importance. We propose a novel orthogonal over-parameterized training (OPT) framework that can provably minimize the hyperspherical energy which characterizes the diversity of neurons on a hypersphere. See our previous work -- MHE for an in-depth introduction.

Weiyang Liu 11 Apr 18, 2022
Code for our CVPR 2021 Paper "Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes".

Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes (CVPR 2021) Project page | Paper | Colab | Colab for Drawing App Rethinking Style

CompVis Heidelberg 153 Jan 4, 2023
Implementation of parameterized soft-exponential activation function.

Soft-Exponential-Activation-Function: Implementation of parameterized soft-exponential activation function. In this implementation, the parameters are

Shuvrajeet Das 1 Feb 23, 2022
Nb workflows - A workflow platform which allows you to run parameterized notebooks programmatically

NB Workflows Description If SQL is a lingua franca for querying data, Jupyter sh

Xavier Petit 6 Aug 18, 2022
This is an open-source toolkit for Heterogeneous Graph Neural Network(OpenHGNN) based on DGL [Deep Graph Library] and PyTorch.

This is an open-source toolkit for Heterogeneous Graph Neural Network(OpenHGNN) based on DGL [Deep Graph Library] and PyTorch.

BUPT GAMMA Lab 519 Jan 2, 2023
This is a model made out of Neural Network specifically a Convolutional Neural Network model

This is a model made out of Neural Network specifically a Convolutional Neural Network model. This was done with a pre-built dataset from the tensorflow and keras packages. There are other alternative libraries that can be used for this purpose, one of which is the PyTorch library.

null 9 Oct 18, 2022
This repository contains notebook implementations of the following Neural Process variants: Conditional Neural Processes (CNPs), Neural Processes (NPs), Attentive Neural Processes (ANPs).

The Neural Process Family This repository contains notebook implementations of the following Neural Process variants: Conditional Neural Processes (CN

DeepMind 892 Dec 28, 2022
A static analysis library for computing graph representations of Python programs suitable for use with graph neural networks.

python_graphs This package is for computing graph representations of Python programs for machine learning applications. It includes the following modu

Google Research 258 Dec 29, 2022
The source code of the paper "Understanding Graph Neural Networks from Graph Signal Denoising Perspectives"

GSDN-F and GSDN-EF This repository provides a reference implementation of GSDN-F and GSDN-EF as described in the paper "Understanding Graph Neural Net

Guoji Fu 18 Nov 14, 2022
Some tentative models that incorporate label propagation to graph neural networks for graph representation learning in nodes, links or graphs.

Some tentative models that incorporate label propagation to graph neural networks for graph representation learning in nodes, links or graphs.

zshicode 1 Nov 18, 2021
On Size-Oriented Long-Tailed Graph Classification of Graph Neural Networks

On Size-Oriented Long-Tailed Graph Classification of Graph Neural Networks We provide the code (in PyTorch) and datasets for our paper "On Size-Orient

Zemin Liu 4 Jun 18, 2022
Graph neural network message passing reframed as a Transformer with local attention

Adjacent Attention Network An implementation of a simple transformer that is equivalent to graph neural network where the message passing is done with

Phil Wang 49 Dec 28, 2022
Implementation of E(n)-Transformer, which extends the ideas of Welling's E(n)-Equivariant Graph Neural Network to attention

E(n)-Equivariant Transformer (wip) Implementation of E(n)-Equivariant Transformer, which extends the ideas from Welling's E(n)-Equivariant G

Phil Wang 132 Jan 2, 2023
Spectral Temporal Graph Neural Network (StemGNN in short) for Multivariate Time-series Forecasting

Spectral Temporal Graph Neural Network for Multivariate Time-series Forecasting This repository is the official implementation of Spectral Temporal Gr

Microsoft 306 Dec 29, 2022
Continuous Diffusion Graph Neural Network

We present Graph Neural Diffusion (GRAND) that approaches deep learning on graphs as a continuous diffusion process and treats Graph Neural Networks (GNNs) as discretisations of an underlying PDE.

Twitter Research 227 Jan 5, 2023
This is the source code for our ICLR2021 paper: Adaptive Universal Generalized PageRank Graph Neural Network.

GPRGNN This is the source code for our ICLR2021 paper: Adaptive Universal Generalized PageRank Graph Neural Network. Hidden state feature extraction i

Jianhao 92 Jan 3, 2023
A PyTorch implementation of "Capsule Graph Neural Network" (ICLR 2019).

CapsGNN ⠀⠀ A PyTorch implementation of Capsule Graph Neural Network (ICLR 2019). Abstract The high-quality node embeddings learned from the Graph Neur

Benedek Rozemberczki 1.2k Jan 2, 2023