This repo provides an official implementation of Biu-MoR as described in the paper:
Semantic Duality in Hypergraphs: Uncertainty-aware Bipolar Evidence Aggregation for Temporal Knowledge Graph Reasoning.
Biu-MoR
├─ data
│ ├─ GDELT
│ ├─ ICEWS14
│ └─ YAGO
├─ rgcn
│ ├─ knowledge_graph.py
│ ├─ layers.py
│ ├─ model.py
│ └─ utils.py
├─ src
│ ├─ decoder.py
│ ├─ get_history.py
│ ├─ hypergraph.py
│ ├─ main.py
│ ├─ model.py
│ └─ rrgcn.py
├─ README.md
└─ requirements.txtconda create -n Biu-MoR python=3.9
conda activate Biu-MoR
pip install -r requirement.txtFor all the datasets, the following command can be used to get the history of their entities and relations.
cd src
python get_history.py --dataset ICEWS14Then the following commands can be used to train Biu-MoR.
Train models
python main.py -d ICEWS14 --consecutive-snapshot-e 4 --consecutive-snapshot-r 2 --history-length-e 9 --history-length-r 7 --hyperedge-e 4 --hyperedge-r 6 --lr 0.001 --n-layers 2 --n-hidden 200 --entity-prediction --relation-prediction --add-static-graph --gpu 0 --save checkpointThe following commands can be used to evaluate Biu-MoR (add --test only).
Test with ground truth history:
python main.py -d ICEWS14 --consecutive-snapshot-e 4 --consecutive-snapshot-r 2 --history-length-e 9 --history-length-r 7 --hyperedge-e 4 --hyperedge-r 6 --lr 0.001 --n-layers 2 --n-hidden 200 --entity-prediction --relation-prediction --add-static-graph --gpu 0 --save checkpoint --test The following commands and trained models can be used to get the entity prediction results reported in the paper (remove --test to train new models).
ICEWS14
python main.py -d ICEWS14 --consecutive-snapshot-e 4 --consecutive-snapshot-r 2 --history-length-e 9 --history-length-r 7 --hyperedge-e 4 --hyperedge-r 6 --lr 0.001 --n-layers 2 --n-hidden 200 --entity-prediction --relation-prediction --add-static-graph --gpu 0 --save checkpoint --test YAGO
python main.py -d YAGO --consecutive-snapshot-e 4 --consecutive-snapshot-r 2 --history-length-e 1 --history-length-r 2 --hyperedge-e 4 --hyperedge-r 6 --lr 0.001 --n-layers 1 --n-hidden 200 --entity-prediction --relation-prediction --gpu 0 --save checkpoint --testGDELT
python main.py -d GDELT --consecutive-snapshot-e 4 --consecutive-snapshot-r 2 --history-length-e 7 --history-length-r 4 --hyperedge-e 4 --hyperedge-r 6 --lr 0.001 --n-layers 2 --n-hidden 200 --entity-prediction --relation-prediction --gpu 0 --save checkpoint --test