Torch-RGCN

Torch-RGCN is a PyTorch implementation of the RGCN, originally proposed by Schlichtkrull et al. in
Modeling Relational Data with Graph Convolutional Networks.

In our paper, we reproduce the link prediction and node classification experiments from the original paper and using our reproduction we explain the RGCN. Furthermore, we present two new configurations of the RGCN.

Getting started

Requirements:

  • Conda >= 4.8
  • Python >= 3.7

Do the following:

  1. Download all datasets: bash get_data.sh

  2. Install the dependencies inside a new virtual environment: bash setup_dependencies.sh

  3. Activate the virtual environment: conda activate torch_rgcn_venv

  4. Install the torch-RGCN module: pip install -e .

Usage

Configuration files

The hyper-parameters for the different experiments can be found in YAML files under
configs. The naming convention of the files is as follows: configs/{MODEL}/{EXPERIMENT}-{DATASET}.yaml

Models

  • rgcn - Standard RGCN Model
  • c-rgcn - Compression RGCN Model
  • e-rgcn - Embedding RGCN Model

Experiments

  • lp - Link Prediction
  • nc - Node Classification

Datasets

Link Prediction

  • WN18
  • FB-Toy

Node Classification

  • AIFB
  • MUTAG
  • BGS
  • AM

Part 1: Reproduction

Link Prediction

link-prediction

Original Link Prediction Implementation: https://github.com/MichSchli/RelationPrediction

To run the link prediction experiment using the RGCN model using:

python experiments/predict_links.py with configs/rgcn/lp-{DATASET}.yaml

Make sure to replace {DATASET} with one of the following dataset names: FB-toy or WN18.

Node Classification

node-classification

Original Node Classification Implementation: https://github.com/tkipf/relational-gcn

To run the node classification experiment using the RGCN model using:

python experiments/classify_nodes.py with configs/rgcn/nc-{DATASET}.yaml

Make sure to replace {DATASET} with one of the following dataset names: AIFB, MUTAG, BGS or AM.

Part 2: New RGCN Configurations

Node Classification with Node Embeddings

To run the node classification experiment use:

python experiments/classify_nodes.py with configs/e-rgcn/nc-{DATASET}.yaml

Make sure to replace {DATASET} with one of the following dataset names: AIFB, MUTAG, BGS or AM.

Link Prediction Compressed Node Embeddings

link-prediction-compression

To run the link prediction experiment use:

python experiments/predict_links.py with configs/c-rgcn/lp-{DATASET}.yaml

Make sure to replace {DATASET} with one of the following dataset names: FB-toy, or WN18.

GitHub

https://github.com/thiviyanT/torch-rgcn