Skip to content

zpw-123/KGAT-pytorch

 
 

Repository files navigation

Knowledge Graph Attention Network

This is PyTorch & DGL implementation for the paper:

Xiang Wang, Xiangnan He, Yixin Cao, Meng Liu and Tat-Seng Chua (2019). KGAT: Knowledge Graph Attention Network for Recommendation. Paper in ACM DL or Paper in arXiv. In KDD'19, Anchorage, Alaska, USA, August 4-8, 2019.

You can find Tensorflow implementation by the paper authors here.

Introduction

Knowledge Graph Attention Network (KGAT) is a new recommendation framework tailored to knowledge-aware personalized recommendation. Built upon the graph neural network framework, KGAT explicitly models the high-order relations in collaborative knowledge graph to provide better recommendation with item side information.

If you want to use codes and datasets in your research, please contact the paper authors and cite the following paper as the reference:

@inproceedings{KGAT19,
  author    = {Xiang Wang and
               Xiangnan He and
               Yixin Cao and
               Meng Liu and
               Tat{-}Seng Chua},
  title     = {{KGAT:} Knowledge Graph Attention Network for Recommendation},
  booktitle = {{KDD}},
  pages     = {950--958},
  year      = {2019}
}

Environment Requirement

The code has been tested running under Python 3.6.8. The required packages are as follows:

  • torch == 1.3.1
  • dgl-cu90 == 0.4.1
  • numpy == 1.15.4
  • pandas == 0.23.1
  • scipy == 1.1.0
  • sklearn == 0.20.0

Run the Codes

  • FM
python main_nfm.py --model_type fm --dataset amazon-book
  • NFM
python main_nfm.py --model_type nfm --dataset amazon-book
  • BPRMF (train on multi-GPUs)
python -m torch.distributed.launch main_bprmf.py --dataset amazon-book
  • ECFKG (train on multi-GPUs)
python -m torch.distributed.launch main_ecfkg.py --dataset amazon-book
  • CKE (train on multi-GPUs)
python -m torch.distributed.launch main_cke.py --dataset amazon-book
  • KGAT
python main_kgat.py --dataset amazon-book

Results

With my code, following are the results of each model when training with dataset amazon-book.

Model Valid Data Best Epoch Precision@20 Recall@20 NDCG@20
FM sample 1000 test users 65 0.014400000683963299 0.14490722119808197 0.07221827559341328
NFM sample 1000 test users 56 0.013850000686943531 0.13833996653556824 0.0724611583347469
BPRMF all test users 65 0.014154779163154574 0.13356850621872207 0.06943918307731874
ECFKG all test users 41 0.013035656309061863 0.12247500353257905 0.06115661206228789
CKE all test users 52 0.014507515353912879 0.13836056015380443 0.07225836488142431
KGAT all test users 31 0.014817044902584718 0.14117674635791852 0.07526633940808744

Final results on all test users

Model Precision@20 Recall@20 NDCG@20
FM 0.0138 0.1309 0.0676
NFM 0.0131 0.1246 0.0655
BPRMF 0.0142 0.1336 0.0694
ECFKG 0.0130 0.1225 0.0612
CKE 0.0145 0.1384 0.0723
KGAT 0.0148 0.1412 0.0753

Related Papers

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%