This code is an implementation of the paper, Knowledge Graph Embedding via Metagraph Learning (SIGIR'21).
This code is based on the OpenKE implementation, which is an open toolkit for knowledge graph embedding.
When you use this code, please cite our paper:
@inproceedings{chung-sigir2021,
author = {Chung, Chanyoung and Whang, Joyce Jiyoung},
title = {Knowledge Graph Embedding via Metagraph Learning},
booktitle = {Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval},
year = {2021},
pages = {2212--2216}
}
To generate a metagraph, use metagraph.py
.
python3 metagraph.py [data] [density]
[data]
: name of the dataset. The name should be the directory name of the dataset contained in the./benchmarks
folder.[density]
: size of the metagraph.
To perform metagraph learning using a particular knowledge graph embedding model on a designated dataset, use meta_[model].py
.
For TransE
, use
CUDA_VISIBLE_DEVICES=0 python3 meta_transe.py [data] [density] [alpha_meta] [margin_meta] [alpha] [margin]
For DistMult
, use
CUDA_VISIBLE_DEVICES=0 python3 meta_distmult.py [data] [density] [alpha_meta] [regul_meta] [alpha] [regul]
For RotatE
, use
CUDA_VISIBLE_DEVICES=0 python3 meta_rotate.py [data] [density] [alpha_meta] [margin_meta] [adv_meta] [alpha] [margin] [adv]