Git Product home page Git Product logo

np-fkgc's Introduction

NP-FKGC

Official code implementation for SIGIR 23 paper Normalizing Flow-based Neural Process for Few-Shot Knowledge Graph Completion

Requirement

pytorch==1.11
tqdm==4.64
normflows==1.4
dgl==0.9.0
tensorboardx==2.5.1

Note: Please make sure dgl==0.9.0 and use CUDA, our codes rely on a small bug of dgl for running.

Environment

  • python 3.8
  • Ubuntu 22.04
  • RTX3090/A100
  • Memory 32G/128G

Dataset & Checkpoint

Original Dataset

Processed Dataset

Download the datasets and extract to the project root folder.

Train

NELL (3090)

python main.py --dataset NELL-One --data_path ./NELL --few 5 --data_form Pre-Train --prefix np_rgcn_attn_planar_nellone_5shot_intrain --device 0 --batch_size 128 --flow Planar --g_batch 1024

WIKI (A100)

python main.py --dataset Wiki-One --data_path ./Wiki --few 5 --data_form Pre-Train --prefix np_rgcn_attn_planar_wiki_5shot_intrain_g_batch_1024_eval_8 --device 0 --batch_size 64 --flow Planar -dim 50 --g_batch 1024 --eval_batch 8 --eval_epoch 4000

FB15K-237 (3090)

python main.py --dataset FB15K-One --data_path ./FB15K --few 5 --data_form Pre-Train --prefix np_rgcn_attn_planar_fb15k_5shot_intrain --device 0 --batch_size 128 --flow Planar --g_batch 1024 --eval_batch_size 128 --K 14

Eval

Download the checkpoint and extract to the state/ folder.

NELL

python main.py --dataset NELL-One --data_path ./NELL --few 5 --data_form Pre-Train --prefix np_rgcn_attn_planar_nellone_5shot_intrain_0.46 --device 0 --batch_size 128 --flow Planar --g_batch 1024 --step test

WIKI

python main.py --dataset Wiki-One --data_path ./Wiki --few 5 --data_form Pre-Train --prefix np_rgcn_attn_planar_wiki_5shot_intrain_g_batch_1024_eval_8_0.503 --device 0 --batch_size 64 --flow Planar -dim 50 --g_batch 1024 --eval_batch 8 --eval_epoch 4000 --step test

FB15K-237

python main.py --dataset FB15K-One --data_path ./FB15K --few 5 --data_form Pre-Train --prefix np_rgcn_attn_planar_fb15k_5shot_intrain_0.536 --device 0 --batch_size 128 --flow Planar --g_batch 1024 --eval_batch_size 128 --K 14 --step test

Results

5-shot FKGC results

Dataset MRR Hits@10 Hits@5 Hits@1
NELL 0.460 0.494 0.471 0.437
WIKI 0.503 0.668 0.599 0.423
FB15K-237 0.538 0.671 0.593 0.476

See full results in our paper.

Citations

If you use this repo, please cite the following paper.

@inproceedings{luo2023npfkgc,
  title     = {Normalizing Flow-based Neural Process for Few-Shot Knowledge Graph Completion},
  author    = {Luo, Linhao and Li, Yuan-Fang and Haffari, Gholamreza and Pan, Shirui},
  booktitle = {The 46th International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year      = {2023}
}

Acknowledgement

This repo is mainly based on GANA. We thank the authors for their great works.

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.