README.md 1.45 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
9
- rdflib
- torchmetrics
Lingfan Yu's avatar
Lingfan Yu committed
10

11
12
13
14
Install as follows:
```bash
pip install rdflib
pip install torchmetrics
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
32
33
For multi-gpu training (with sampling), run with the following (same datasets and GPU IDs separated by comma) 
```bash
python3 entity_sample_multi_gpu.py --dataset aifb --gpu 0,1
34
35
```

36

Lingfan Yu's avatar
Lingfan Yu committed
37
### Link Prediction
38
FB15k-237 in RAW-MRR
Lingfan Yu's avatar
Lingfan Yu committed
39
```
Mufei Li's avatar
Mufei Li committed
40
python link.py --gpu 0 --eval-protocol raw
41
```
42
FB15k-237 in Filtered-MRR
43
```
Mufei Li's avatar
Mufei Li committed
44
python link.py --gpu 0 --eval-protocol filtered
Lingfan Yu's avatar
Lingfan Yu committed
45
```
46
47
48
49
50
51
52
53
54
55
56
57

Summary 
-------

### 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