Skip to content
/ PathCon Public

Combining relational context and relational paths for knowledge graph completion

License

Notifications You must be signed in to change notification settings

hyren/PathCon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PathCon

This repository is the PyTorch implementation of PathCon (arXiv):

Entity Context and Relational Paths forKnowledge Graph Completion
Hongwei Wang, Hongyu Ren, Jure Leskovec
arXiv Preprint, 2020

Please find the Tensorflow version here.

PathCon considers relational context and relational paths of (head, tail) pair in knowledge graphs for link prediction. PathCon achieves substantial gains over state-of-the-art baselines. Below is the result of Hit@1 on the test set of FB15K, FB15K-237, WN18, WN18RR, NELL995, and DDB14 datasets for relation prediction task:

Method FB15K FB15K-237 WN18 WN18RR NELL995 DDB14
TransE 94.0 94.6 95.5 66.9 78.1 94.8
RotatE 96.7 95.1 97.9 73.5 69.1 93.4
QuatE 97.2 95.8 97.5 76.7 70.6 92.2
DRUM 94.5 90.5 95.6 77.8 64.0 93.0
PathCon 97.4 (+/-0.2) 96.4 (+/-0.1) 98.8 (+/-0.1) 95.4 (+/-0.2) 84.4 (+/-0.4) 96.6 (+/-0.1)

For more results, please refer to the original paper.

Files in the folder

  • data/
    • FB15k/
    • FB15k-237/
    • wn18/
    • wn18rr/
    • NELL995/
    • DDB14/
  • src/: implementation of PathCon.

Note: We provide a cache/ folder for each dataset, which caches the pre-computed relational paths for this dataset. This folder is not required for running the code because relational paths will be counted (and cached) if no corresponding cache file is found. If you are going to run FB15K-237 with max_path_len=3, please first download and unzip paths_3.zip from here and put all unzipped files under FB15k-237/cache/ (the original files cannot be uploaded to GitHub due to the limitation on file size). Again, this is not required but highly recommended because counting length-3 paths for FB15K-237 will be time-consuming.

Running the code

$ python main.py --cuda

Note: The default dataset is set as WN18RR. Hyper-parameter settings for other datasets are provided in main.py.

Required packages

The code has been tested running under Python 3.6.5, with the following packages installed (along with their dependencies):

  • torch == 1.4.0
  • numpy == 1.16.5
  • scipy == 1.3.1
  • sklearn == 0.21.3

About

Combining relational context and relational paths for knowledge graph completion

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages