Skip to content
forked from yybdpq/Biu-MoR

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.

Notifications You must be signed in to change notification settings

ICDM-UESTC/Biu-MoR

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Biu-MoR

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.

Source Code Structure

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.txt

Installation

conda create -n Biu-MoR python=3.9
conda activate Biu-MoR
pip install -r requirement.txt

How to run

Process data

For 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 ICEWS14

Train models

Then 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 checkpoint

Evaluate models

The 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 

Detailed hyperparameters

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

GDELT

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

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%