Code Monkey home page Code Monkey logo

pathcon's Introduction

PathCon

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

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

(A PyTorch implementation of PathCon can be found 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

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):

  • tensorflow == 1.12.0
  • numpy == 1.16.5
  • scipy == 1.3.1
  • sklearn == 0.21.3

pathcon's People

Contributors

hwwang55 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.