zjukg / AnKGE

[Paper][AAAI2023] Analogical Inference Enhanced Knowledge Graph Embedding
Apache License 2.0
10 stars 4 forks source link

AnKGE

This repository contains code for:

Abstract

We propose a novel and general self-supervised framework AnKGE to enhance KGE models with analogical inference capability. First, we retrieve appropriate analogical objects from entity-level, relation-level, and triple level. Second, we train an analogy function for each level of analogical inference with the original element embedding from a well-trained KGE model as input, which outputs the analogical object embedding. Finally, in order to combine direct inference capability from the original KGE model and analogical inference capability enhanced by AnKGE, we interpolate the analogy score with the base model score. Through extensive experiments on FB15k-237 and WN18RR datasets, AnKGE remakes the rank of hard-predicted triples in the base model by analogical inference, achieving competitive results in the link prediction task.

Model Architecture

Dependencies

Usage

Training and Testing

Step1 Create a virtual environment using Anaconda and enter it

conda create -n ankge python=3.8
conda activate ankge

Step2 Install package

pip install -r requirements.txt

Step3 Train and test base model

# FB15k-237
sh scripts/FreeBase/TransE_Rev_FB.sh
sh scripts/FreeBase/RotatE_Rev_FB.sh
sh scripts/FreeBase/HAKE_Rev_FB.sh
sh scripts/FreeBase/PairRE_Rev_FB.sh
# WN18RR
sh scripts/WordNet/TransE_Rev_WN.sh
sh scripts/WordNet/RotatE_Rev_WN.sh
sh scripts/WordNet/HAKE_Rev_WN.sh
sh scripts/WordNet/PairRE_Rev_WN.sh

Step4 Train and test AnKGE with base model

# FB15k-237
sh scripts/FreeBase/AnKnn_TransE_Rev_FB.sh
sh scripts/FreeBase/AnKnn_RotatE_Rev_FB.sh
sh scripts/FreeBase/AnKnn_HAKE_Rev_FB.sh
sh scripts/FreeBase/AnKnn_PairRE_Rev_FB.sh
# WN18RR
sh scripts/WordNet/AnKnn_TransE_Rev_WN.sh
sh scripts/WordNet/AnKnn_RotatE_Rev_WN.sh
sh scripts/WordNet/AnKnn_HAKE_Rev_WN.sh
sh scripts/WordNet/AnKnn_PairRE_Rev_WN.sh

Note:

Cite:

Please condiser citing this paper if you use the code or data from our work.

Thanks a lot : )

@InProceedings{AnKGE,
    author    = {Yao Zhen, 
                 Zhang Wen, 
                 Chen Mingyang, 
                 Huang Yufeng, 
                 Yang Yi and
                 Chen Huajun},
    title     = {Analogical Inference Enhanced Knowledge Graph Embedding},
    booktitle = {Proceedings of the Thirty-Seventh AAAI Conference on Artificial Intelligence (AAAI)},
    year      = {2023}
}