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:
-
Download all datasets:
bash get_data.sh
-
Install the dependencies inside a new virtual environment:
bash setup_dependencies.sh
-
Activate the virtual environment:
conda activate torch_rgcn_venv
-
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 Modelc-rgcn
- Compression RGCN Modele-rgcn
- Embedding RGCN Model
Experiments
lp
- Link Predictionnc
- Node Classification
Datasets
Link Prediction
WN18
FB-Toy
Node Classification
AIFB
MUTAG
BGS
AM
Part 1: Reproduction
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
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
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
.