• Stars
    star
    249
  • Rank 162,987 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 5 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The code of paper Learning Hierarchy-Aware Knowledge Graph Embeddings for Link Prediction. Zhanqiu Zhang, Jianyu Cai, Yongdong Zhang, Jie Wang. AAAI 2020.

HAKE: Hierarchy-Aware Knowledge Graph Embedding

This is the code of paper Learning Hierarchy-Aware Knowledge Graph Embeddings for Link Prediction. Zhanqiu Zhang, Jianyu Cai, Yongdong Zhang, Jie Wang. AAAI 2020. arxiv

Dependencies

Results

The results of HAKE and the baseline model ModE on WN18RR, FB15k-237 and YAGO3-10 are as follows.

WN18RR

MRR HITS@1 HITS@3 HITS@10
ModE 0.472 0.427 0.486 0.564
HAKE 0.496 ± 0.001 0.452 0.516 0.582

FB15k-237

MRR HITS@1 HITS@3 HITS@10
ModE 0.341 0.244 0.380 0.534
HAKE 0.346 ± 0.001 0.250 0.381 0.542

YAGO3-10

MRR HITS@1 HITS@3 HITS@10
ModE 0.510 0.421 0.562 0.660
HAKE 0.546 ± 0.001 0.462 0.596 0.694

Running the code

Usage

bash runs.sh {train | valid | test} {ModE | HAKE} {wn18rr | FB15k-237 | YAGO3-10} <gpu_id> \
<save_id> <train_batch_size> <negative_sample_size> <hidden_dim> <gamma> <alpha> \
<learning_rate> <num_train_steps> <test_batch_size> [modulus_weight] [phase_weight]
  • { | }: Mutually exclusive items. Choose one from them.
  • < >: Placeholder for which you must supply a value.
  • [ ]: Optional items.

Remark: [modulus_weight] and [phase_weight] are available only for the HAKE model.

To reproduce the results of HAKE and ModE, run the following commands.

HAKE

# WN18RR
bash runs.sh train HAKE wn18rr 0 0 512 1024 500 6.0 0.5 0.00005 80000 8 0.5 0.5

# FB15k-237
bash runs.sh train HAKE FB15k-237 0 0 1024 256 1000 9.0 1.0 0.00005 100000 16 3.5 1.0

# YAGO3-10
bash runs.sh train HAKE YAGO3-10 0 0 1024 256 500 24.0 1.0 0.0002 180000 4 1.0 0.5

ModE

# WN18RR
bash runs.sh train ModE wn18rr 0 0 512 1024 500 6.0 0.5 0.0001 80000 8 --no_decay

# FB15k-237
bash runs.sh train ModE FB15k-237 0 0 1024 256 1000 9.0 1.0 0.0001 100000 16

# YAGO3-10
bash runs.sh train ModE YAGO3-10 0 0 1024 256 500 24.0 1.0 0.0002 80000 4

Visualization

To plot entity embeddings on a 2D plane (Figure 4 in our paper), please refer to this issue.

Citation

If you find this code useful, please consider citing the following paper.

@inproceedings{zhang2020learning,
  title={Learning Hierarchy-Aware Knowledge Graph Embeddings for Link Prediction},
  author={Zhang, Zhanqiu and Cai, Jianyu and Zhang, Yongdong and Wang, Jie},
  booktitle={Thirty-Fourth {AAAI} Conference on Artificial Intelligence},
  pages={3065--3072},
  publisher={{AAAI} Press},
  year={2020}
}

Acknowledgement

We refer to the code of RotatE. Thanks for their contributions.

Other Repositories

If you are interested in our work, you may find the following paper useful.

Duality-Induced Regularizer for Tensor Factorization Based Knowledge Graph Completion. Zhanqiu Zhang, Jianyu Cai, Jie Wang. NeurIPS 2020. [paper] [code]

More Repositories

1

GCN4KGC

The code of paper Rethinking Graph Convolutional Networks in Knowledge Graph Completion. Zhanqiu Zhang, Jie Wang, Jieping Ye, Feng Wu. WWW 2022.
Python
56
star
2

KGE-DURA

The code of paper Duality-Induced Regularizer for Tensor Factorization Based Knowledge Graph Completion. Zhanqiu Zhang, Jianyu Cai, Jie Wang. NeurIPS 2020.
Python
50
star
3

L2O-HEM-Torch

The code of paper Learning Cut Selection for Mixed-Integer Linear Programming via Hierarchical Sequence Model. Zhihai Wang, Xijun Li, Jie Wang*, Yufei Kuang, Mingxuan Yuan, Jia Zeng, Yongdong Zhang, Feng Wu. ICLR 2023.
Python
46
star
4

AI4Sci-MiCaM

This is the code of paper "De Novo Molecular Generation via Connection-aware Motif Mining". Zijie Geng, Shufang Xie, Yingce Xia, Lijun Wu, Tao Qin, Jie Wang, Yongdong Zhang, Feng Wu, Tie-Yan Liu. ICLR 2023.
Python
46
star
5

QE-ConE

The code of paper ConE: Cone Embeddings for Multi-Hop Reasoning over Knowledge Graphs. Zhanqiu Zhang, Jie Wang, Jiajun Chen, Shuiwang Ji, Feng Wu. NeurIPS 2021.
Python
43
star
6

GNN-LMC

The code of paper LMC: Fast Training of GNNs via Subgraph Sampling with Provable Convergence. Zhihao Shi, Xize Liang, Jie Wang. ICLR 2023.
Python
42
star
7

GraphAKD

The code of paper Compressing Deep Graph Neural Networks via Adversarial Knowledge Distillation. Huarui He, Jie Wang, Zhanqiu Zhang, Feng Wu. SIGKDD 2022.
Python
40
star
8

KG-TACT

The code of paper Topology-Aware Correlations Between Relations for Inductive Link Prediction in Knowledge Graphs. Jiajun Chen, Huarui He, Feng Wu, Jie Wang. AAAI 2021.
Python
39
star
9

RLPapers

Must-read papers on Reinforcement Learning (RL)
36
star
10

KGEPapers

Must-read papers on Knowledge Graph Embedding
25
star
11

KGRPapers

Must-read papers on Knowledge Graph Reasoning (KGR)
22
star
12

L2O-G2MILP

This is the code for G2MILP, a deep learning-based mixed-integer linear programming (MILP) instance generator.
Python
22
star
13

RL-CMBAC

The code of paper Sample-Efficient Reinforcement Learning via Conservative Model-Based Actor-Critic. Zhihai Wang, Jie Wang*, Qi Zhou, Bin Li, Houqiang Li. AAAI 2022.
Python
18
star
14

RL-SCPO

The code of paper *Learning Robust Policy against Disturbance in Transition Dynamics via State-Conservative Policy Optimization*.
Python
14
star
15

DD-RetroDCVAE

A novel template-free retrosynthesizer that can generate diverse sets of reactants for a desired product via discrete conditional variational autoencoders.
Python
14
star
16

KDDCup2021_WikiKG90M_GraphMIRAcles

Python
8
star
17

D-SPIDER-SFO

Python
7
star
18

RL-SPF

a representation learning method that predicts the Fourier transform of state sequences to improve sample efficiency of RL algorithms.
Python
6
star
19

RL-CBM

The code of paper Robust Representation learning by Clustering with Bisimulation Metrics for Visual Reinforcement Learning with Distractions. Qiyuan Liu, Qi Zhou, Rui Yang, Jie Wang. AAAI 2023.
Python
5
star
20

RL-CRESP

Python
5
star
21

Data-for-Reinforcement-Learning-Baselines

Results and data for reinforcement learning algorithms.
4
star
22

AI4LogicSynthesis-PruneX

Python
3
star
23

RL-POMBU

Python
3
star
24

RL-ACED

The code of paper *Promoting Stochasticity for Expressive Policies viaa Simple and Efficient Regularization Method*.
Python
3
star
25

MIRA-Book-for-Reinforcement-Learning

MIRA Book for Reinforcement Learning (draft)
2
star
26

VCells

The implementation of the VCells algorithm
JavaScript
2
star
27

L2O-Symb4CO

The code of paper *Rethinking Branching on Exact Combinatorial Optimization Solver: The First Deep Symbolic Discovery Framework*.
Python
2
star
28

DCRN

This is the code of paper Deep Cognitive Reasoning Network for Multi-hop Question Answering over Knowledge Graphs. Jianyu Cai, Zhanqiu Zhang, Feng Wu, Jie Wang. Findings of ACL 2021
Python
2
star
29

RL-RAEB

This is the code for the paper "Efficient Exploration in Resource-Restricted Reinforcement Learning" (https://arxiv.org/abs/2212.06988)
Python
1
star
30

EAPapers

Must-read papers on Entity Alignment
1
star
31

MIRA-Book-for-Representation-Learning

MIRA Book for Representation Learning (draft)
1
star
32

LD

Python
1
star
33

RL-TRACER

Python
1
star