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

Gan Quan's avatar
Gan Quan committed
3
4
5
6
* Paper: [https://arxiv.org/abs/1703.06103](https://arxiv.org/abs/1703.06103)
* 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
8
9
10
11
### Dependencies
* PyTorch 0.4.1+
* requests
* rdflib
* pandas
Lingfan Yu's avatar
Lingfan Yu committed
12

13
14
15
```
pip install requests torch rdflib pandas
```
Lingfan Yu's avatar
Lingfan Yu committed
16
17
18
19

Example code was tested with rdflib 4.2.2 and pandas 0.23.4

### Entity Classification
20
AIFB: accuracy 97.22% (DGL), 95.83% (paper)
Lingfan Yu's avatar
Lingfan Yu committed
21
22
23
24
```
python3 entity_classify.py -d aifb --testing --gpu 0
```

25
MUTAG: accuracy 75% (DGL), 73.23% (paper)
Lingfan Yu's avatar
Lingfan Yu committed
26
27
28
29
```
python3 entity_classify.py -d mutag --l2norm 5e-4 --n-bases 30 --testing --gpu 0
```

30
BGS: accuracy 82.76% (DGL), 83.10% (paper)
Lingfan Yu's avatar
Lingfan Yu committed
31
32
33
34
```
python3 entity_classify.py -d bgs --l2norm 5e-4 --n-bases 40 --testing --gpu 0 --relabel
```

35
36
37
38
39
AM: accuracy 87.37% (DGL), 89.29% (paper)
```
python3 entity_classify.py -d am --n-bases=40 --n-hidden=10 --l2norm=5e-4 --testing
```

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
### Entity Classification with minibatch
AIFB: accuracy avg(5 runs) 94.99%, best 97.22% (DGL)
```
python3 entity_classify_mp.py -d aifb --testing --gpu 0 --fanout=20 --batch-size 128
```

MUTAG: accuracy avg(5 runs) 67.06%, best 80.88% (DGL)
```
python3 entity_classify_mp.py -d mutag --l2norm 5e-4 --n-bases 30 --testing --gpu 0 --batch-size 256 --use-self-loop --n-epochs 40 --dropout=0.3
```

```
python3 entity_classify_mp.py -d bgs --l2norm 5e-4 --n-bases 40 --testing --gpu 0 --fanout 40 --n-epochs=40 --batch-size=128
```

BGS: accuracy avg(5 runs) 84.14%, best 89.66% (DGL)

```
python3 entity_classify_mp.py -d bgs --l2norm 5e-4 --n-bases 40 --testing --gpu 0 --fanout 40 --n-epochs=40 --batch-size=128
```

AM: accuracy avg(5 runs) 88.28%, best 90.91% (DGL)
```
python3 entity_classify_mp.py -d am --l2norm 5e-4 --n-bases 40 --testing --gpu 0 --fanout 35 --batch-size 256 --lr 1e-2 --n-hidden 16 --use-self-loop --n-epochs=40
```

Lingfan Yu's avatar
Lingfan Yu committed
66
### Link Prediction
67
FB15k-237: MRR 0.151 (DGL), 0.158 (paper)
Lingfan Yu's avatar
Lingfan Yu committed
68
```
69
70
71
72
73
python3 link_predict.py -d FB15k-237 --gpu 0 --raw
```
FB15k-237: Filtered-MRR 0.2044
```
python3 link_predict.py -d FB15k-237 --gpu 0 --filtered
Lingfan Yu's avatar
Lingfan Yu committed
74
```