DIR-GNN - Discovering Invariant Rationales for Graph Neural Networks

Overview

DIR-GNN

"Discovering Invariant Rationales for Graph Neural Networks" (ICLR 2022) aims to train intrinsic interpretable Graph Neural Networks that are generalizable to out-of-distribution datasets. The core of this work lies in the construction of environments, i.e., interventional distributions, and thus discovering the causal features for rationalization.

Installation

  • Main packages: PyTorch >= 1.5.0, Pytorch Geometric >= 1.7.0, OGB >= 1.3.0.
  • See requirements.txt for other packages.

Data download

  • Spurious-Motif: this dataset can be generated via spmotif_gen/spmotif.ipynb.
  • Graph-SST2: this dataset can be downloaded here.
  • MNIST-75sp: this dataset can be downloaded here. Download mnist_75sp_train.pkl, mnist_75sp_test.pkl, and mnist_75sp_noise.pt to the directory data/MNISTSP/raw/.
  • OGBG-Molhiv: this dataset will be downloaded automatically.

Run DIR

The hyper-parameters used to train the intrinsic interpretable models are set as default in the argparse.ArgumentParser in the training files. Feel free to change them if needed. We use separate files to train each dataset as the graph convolutional layers of the rationale generators are different.

Simply run python spmotif_dir.py to reproduce the results in the paper.

(TODO)

Reference

@inproceedings{
shirley2022dir,
title={Discovering Invariant Rationales for Graph Neural Networks},
author={Ying-Xin Wu and Xiang Wang and An Zhang and Xiangnan He and Tat-seng Chua},
booktitle={ICLR},
year={2022},
}
You might also like...
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

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.

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

QA-GNN: Question Answering using Language Models and Knowledge Graphs
QA-GNN: Question Answering using Language Models and Knowledge Graphs

QA-GNN: Question Answering using Language Models and Knowledge Graphs This repo provides the source code & data of our paper: QA-GNN: Reasoning with L

Distance Encoding for GNN Design

Distance-encoding for GNN design This repository is the official PyTorch implementation of the DEGNN and DEAGNN framework reported in the paper: Dista

Geometric Vector Perceptron --- a rotation-equivariant GNN for learning from biomolecular structure

Geometric Vector Perceptron Code to accompany Learning from Protein Structure with Geometric Vector Perceptrons by B Jing, S Eismann, P Suriana, RJL T

GNN-based Recommendation Benchma
GNN-based Recommendation Benchma

GRecX A Fair Benchmark for GNN-based Recommendation Preliminary Comparison DiffNet-Yelp dataset (featureless) Algo nDCG@5 nDCG@10 nDCG@15 MF 0.158707

Geometric Vector Perceptrons --- a rotation-equivariant GNN for learning from biomolecular structure
Geometric Vector Perceptrons --- a rotation-equivariant GNN for learning from biomolecular structure

Geometric Vector Perceptron Implementation of equivariant GVP-GNNs as described in Learning from Protein Structure with Geometric Vector Perceptrons b

Complex-Valued Neural Networks (CVNN)Complex-Valued Neural Networks (CVNN)

Complex-Valued Neural Networks (CVNN) Done by @NEGU93 - J. Agustin Barrachina Using this library, the only difference with a Tensorflow code is that y

Comments
  • requirements.txt

    requirements.txt

    There is an absolute path in the requirements file. Can you regenerate the requirements file without an absolute path? Or you can use this command pip list --format=freeze > requirements.txt thanks

    opened by Never-yu 2
  • Dataset MolHIV

    Dataset MolHIV

    Hi, thanks for sharing the code. However, I wonder whether you miss out on one of the four datasets used in your paper: the MolHIV dataset. Can you please provide some information regarding how you use it and the relevant code?

    opened by smiles724 2
  • default random seed shouldn't set to 1 if you train in `for seed in args.seed`

    default random seed shouldn't set to 1 if you train in `for seed in args.seed`

    When you use default seed = 1 to train in for seed in args.seed, you only put one value to all_info, then you will get nan when calculate torch.tensor(all_info['...']).std() because in tensor.std is divided by n-1 Screen Shot 2022-05-10 at 00 57 45

    opened by Eurus-Holmes 1
  • Question about the Spurious-Motif dataset

    Question about the Spurious-Motif dataset

    Hi, I'm really interested in this work and I have a question about the line 45-48 of DIR-GNN/datasets/spmotif_dataset.py

    x = torch.zeros(node_idx.size(0), 4)
    index = [i for i in range(node_idx.size(0))]
    x[index, z] = 1
    x = torch.rand((node_idx.size(0), 4))
    

    I'm wondering if the node feature randomized or generated from the role id ?

    opened by jypeng28 0
Owner
Ying-Xin (Shirley) Wu
Senior Undergraduate @ LDS, School of Data Science. [email protected]
Ying-Xin (Shirley) Wu
[CIKM 2019] Code and dataset for "Fi-GNN: Modeling Feature Interactions via Graph Neural Networks for CTR Prediction"

FiGNN for CTR prediction The code and data for our paper in CIKM2019: Fi-GNN: Modeling Feature Interactions via Graph Neural Networks for CTR Predicti

Big Data and Multi-modal Computing Group, CRIPAC 75 Dec 30, 2022
Expressive Power of Invariant and Equivaraint Graph Neural Networks (ICLR 2021)

Expressive Power of Invariant and Equivaraint Graph Neural Networks In this repository, we show how to use powerful GNN (2-FGNN) to solve a graph alig

Marc Lelarge 36 Dec 12, 2022
A graph neural network (GNN) model to predict protein-protein interactions (PPI) with no sample features

A graph neural network (GNN) model to predict protein-protein interactions (PPI) with no sample features

null 2 Jul 25, 2022
Ian Covert 130 Jan 1, 2023
《Truly shift-invariant convolutional neural networks》(2021)

Truly shift-invariant convolutional neural networks [Paper] Authors: Anadi Chaman and Ivan Dokmanić Convolutional neural networks were always assumed

Anadi Chaman 46 Dec 19, 2022
discovering subdomains, hidden paths, extracting unique links

python-website-crawler discovering subdomains, hidden paths, extracting unique links pip install -r requirements.txt discover subdomain: You can give

merve 4 Sep 5, 2022
Supplementary code for SIGGRAPH 2021 paper: Discovering Diverse Athletic Jumping Strategies

SIGGRAPH 2021: Discovering Diverse Athletic Jumping Strategies project page paper demo video Prerequisites Important Notes We suspect there are bugs i

null 54 Dec 6, 2022
The self-supervised goal reaching benchmark introduced in Discovering and Achieving Goals via World Models

Lexa-Benchmark Codebase for the self-supervised goal reaching benchmark introduced in 'Discovering and Achieving Goals via World Models'. Setup Create

null 1 Oct 14, 2021
Discovering Interpretable GAN Controls [NeurIPS 2020]

GANSpace: Discovering Interpretable GAN Controls Figure 1: Sequences of image edits performed using control discovered with our method, applied to thr

Erik Härkönen 1.7k Jan 3, 2023
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