README.md 1.73 KB
Newer Older
Lingfan Yu's avatar
Lingfan Yu committed
1
2
# Relational-GCN

Mufei Li's avatar
Mufei Li committed
3
* Paper: [Modeling Relational Data with Graph Convolutional Networks](https://arxiv.org/abs/1703.06103)
Gan Quan's avatar
Gan Quan committed
4
5
6
* Author's code for entity classification: [https://github.com/tkipf/relational-gcn](https://github.com/tkipf/relational-gcn)
* Author's code for link prediction: [https://github.com/MichSchli/RelationPrediction](https://github.com/MichSchli/RelationPrediction)

7
### Dependencies
8
- rdflib
9
- torchmetrics 0.11.4
Lingfan Yu's avatar
Lingfan Yu committed
10

11
12
13
Install as follows:
```bash
pip install rdflib
14
pip install torchmetrics==0.11.4
15
```
Lingfan Yu's avatar
Lingfan Yu committed
16

17
18
How to run
-------
Lingfan Yu's avatar
Lingfan Yu committed
19
20
21

### Entity Classification

22
23
24
Run with the following for entity classification (available datasets: aifb (default), mutag, bgs, and am)
```bash
python3 entity.py --dataset aifb
25
26
```

27
28
29
For mini-batch training, run with the following (available datasets are the same as above)
```bash
python3 entity_sample.py --dataset aifb
30
```
31
For multi-gpu training (with sampling), run with the following (same datasets and GPU IDs separated by comma)
32
33
```bash
python3 entity_sample_multi_gpu.py --dataset aifb --gpu 0,1
34
35
```

Lingfan Yu's avatar
Lingfan Yu committed
36
### Link Prediction
37
38
39
40
41

Run with the following for link prediction on dataset FB15k-237 with filtered-MRR

```bash
python link.py
Lingfan Yu's avatar
Lingfan Yu committed
42
```
43
44
> **_NOTE:_** By default, we use uniform edge sampling instead of neighbor-based edge sampling as in [author's code](https://github.com/MichSchli/RelationPrediction). In practice, we find that it can achieve similar MRR.

45

46
Summary
47
48
49
50
51
52
53
54
55
56
-------

### Entity Classification

| Dataset       | Full-graph | Mini-batch
| ------------- | -------    |  ------
| aifb          | ~0.85      | ~0.82
| mutag         | ~0.70      | ~0.50
| bgs           | ~0.86      | ~0.64
| am            | ~0.78      | ~0.42
57
58
59
60
61

### Link Prediction
| Dataset       | Best MRR
| ------------- | -------
| FB15k-237     | ~0.2439