This DGL example implements the GNN model proposed in the paper CompositionGCN. The author's codes of implementation is in here
This example was implemented by zhjwy9343 and KounianhuaDu at the AWS Shanghai AI Lab.
- pytorch 1.9.0
- dgl 0.7.1
- numpy 1.20.3
- ordered_set 4.0.2
The datasets used for link predictions are FB15k-237 constructed from Freebase and WN18RR constructed from WordNet. The statistics are summarized as followings:
FB15k-237
- Nodes: 14541
- Relation types: 237
- Reversed relation types: 237
- Train: 272115
- Valid: 17535
- Test: 20466
WN18RR
- Nodes: 40943
- Relation types: 11
- Reversed relation types: 11
- Train: 86835
- Valid: 3034
- Test: 3134
First to get the data, one can run
sh get_fb15k-237.sh
sh get_wn18rr.sh
Then for FB15k-237, run
python main.py --score_func conve --opn ccorr --gpu 0 --data FB15k-237
For WN18RR, run
python main.py --score_func conve --opn ccorr --gpu 0 --data wn18rr
Link Prediction Results
Dataset | FB15k-237 | WN18RR |
---|---|---|
Metric | Paper / ours (dgl) | Paper / ours (dgl) |
MRR | 0.355 / 0.348 | 0.479 / 0.466 |
MR | 197 / 208 | 3533 / 3542 |
Hit@10 | 0.535 / 0.527 | 0.546 / 0.525 |
Hit@3 | 0.390 / 0.380 | 0.494 / 0.476 |
Hit@1 | 0.264 / 0.259 | 0.443 / 0.435 |