Giter Site home page Giter Site logo

xiaohanhwang / diffkg Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hkuds/diffkg

0.0 0.0 0.0 21.19 MB

[WSDM'2024 Oral] "DiffKG: Knowledge Graph Diffusion Model for Recommendation"

Home Page: https://arxiv.org/abs/2312.16890

Python 100.00%

diffkg's Introduction

DiffKG: Knowledge Graph Diffusion Model for Recommendation

This is the PyTorch implementation for DiffKG proposed in the paper DiffKG: Knowledge Graph Diffusion Model for Recommendation, which is accepted by WSDM 2024 Oral.

Yangqin Jiang, Yuhao Yang, Lianghao Xia, and Chao Huang. 2024. DiffKG: Knowledge Graph Diffusion Model for Recommendation. In Proceedings of the 17th ACM International Conference on Web Search and Data Mining (WSDM โ€™24), March 4โ€“8, 2024, Merida, Mexico. ACM, New York, NY, USA, 9 pages.

In this paper, we propose a novel knowledge graph diffusion model for recommendation, referred to as DiffKG. Our framework integrates a generative diffusion model with a data augmentation paradigm, enabling robust knowledge graph representation learning. This integration facilitates a better alignment between knowledge-aware item semantics and collaborative relation modeling. Moreover, we introduce a collaborative knowledge graph convolution mechanism that incorporates collaborative signals reflecting user-item interaction patterns, guiding the knowledge graph diffusion process.

๐Ÿ“ Environment

We develop our codes in the following environment:

  • python==3.9.13
  • numpy==1.23.1
  • torch==1.11.0
  • scipy==1.9.1

๐Ÿ“š Datasets

Statistics Last-FM MIND Alibaba-iFashion
# Users 23,566 100,000 114,737
# Items 48,123 30,577 30,040
# Interactions 3,034,796 2,975,319 1,781,093
# Density 2.7 ร— $10^{-3}$ 9.7 ร— $10^{-4}$ 5.2 ร— $10^{-4}$
Knowledge Graph
# Entities 58,266 24,733 59,156
# Relations 9 512 51
# Triplets 464,567 148,568 279,155

๐Ÿš€ How to run the codes

The command lines to train DiffKG on the three datasets are as below. The un-specified hyperparameters in the commands are set as default.

  • Last-FM
python Main.py --data lastfm --reg 1e-5 --mess_dropout_rate 0.2 --layer_num_kg 2 --res_lambda 0 --triplet_num -1 --cl_pattern 1 --keepRate 0.1 --e_loss 0.01
  • MIND
python Main.py --data mind --e_loss 0.1 --temp 1 --ssl_reg 1 --mess_dropout_rate 0.2 --res_lambda 1
  • Alibaba-iFashion
python Main.py --data alibaba --reg 1e-6 --epoch 50 --ssl_reg 1 --temp 1

๐Ÿš€ Run DiffKG via SSLRec

DiffKG has been integrated into SSLRec! SSLRec is a PyTorch-based open-source deep learning framework for recommender systems enhanced by self-supervised learning techniques. With SSLRec, you can easily compare our DiffKG with other research works in the field of KG-enhanced recommendation systems.

๐Ÿ‘‰ Code Structure

.
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ DiffKG.png
โ”œโ”€โ”€ performance.png
โ”œโ”€โ”€ Main.py
โ”œโ”€โ”€ Model.py
โ”œโ”€โ”€ Params.py
โ”œโ”€โ”€ DataHandler.py
โ”œโ”€โ”€ Utils
โ”‚ย ย  โ”œโ”€โ”€ TimeLogger.py
โ”‚ย ย  โ””โ”€โ”€ Utils.py
โ””โ”€โ”€ Datasets
    โ”œโ”€โ”€ alibaba
    โ”‚ย ย  โ”œโ”€โ”€ trnMat.pkl
    โ”‚ย ย  โ”œโ”€โ”€ tstMat.pkl
    โ”‚   โ””โ”€โ”€ kg.txt
    โ”œโ”€โ”€ lastFM
    โ”‚ย ย  โ”œโ”€โ”€ trnMat.pkl
    โ”‚ย ย  โ”œโ”€โ”€ tstMat.pkl
    โ”‚   โ””โ”€โ”€ kg.txt
    โ””โ”€โ”€ mind
     ย ย  โ”œโ”€โ”€ trnMat.pkl
     ย ย  โ”œโ”€โ”€ tstMat.pkl
        โ””โ”€โ”€ kg.txt

๐ŸŽฏ Experimental Results

Performance comparison of baselines on different datasets in terms of Recall@20 and NDCG@20:

๐ŸŒŸ Citation

If you find this work helpful to your research, please kindly consider citing our paper.

@article{jiang2023diffkg,
  title={DiffKG: Knowledge Graph Diffusion Model for Recommendation},
  author={Jiang, Yangqin and Yang, Yuhao and Xia, Lianghao and Huang, Chao},
  journal={arXiv preprint arXiv:2312.16890},
  year={2023}
}

diffkg's People

Contributors

zzmeei avatar hkuds 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.