Git Product home page Git Product logo

khgt's Introduction

Knowledge-Enhanced Graph Transformer

This repository contains TensorFlow codes and datasets for the paper:

Lianghao Xia, Chao Huang, Yong Xu, Peng Dai, Xiyue Zhang, Hongsheng Yang, Jian Pei, Liefeng Bo (2021). Knowledge-Enhanced Hierarchical Graph Transformer Network for Multi-Behavior Recommendation, Paper in AAAI, Paper in ArXiv. In AAAI'21, Online, February 2-9, 2021.

Introduction

Knowledge-Enhanced Graph Transformer (KHGT) is a graph-based recommender system focusing on multi-behavior user-item relation learning. The main characteristics of this model includes: i) it incorporates item-side knowledge information to enhance the item embedding learning, ii) the method explicitly models the cross-type dependencies between different user behavior categories, using a hierarchical graph transformer framework, iii) its time-aware graph neural architecture captures the dynamic characteristics of multi-typed user-item interactions.

Citation

If you want to use our codes and datasets in your research, please cite:

@inproceedings{xia2021khgt,
  author    = {Xia, Lianghao and
               Huang, Chao and
               Xu, Yong and
               Dai, Peng and
               Zhang, Xiyue and
               Yang, Hongsheng and
               Pei, Jian and
               Bo, Liefeng},
  title     = {Knowledge-Enhanced Hierarchical Graph Transformer Network for Multi-Behavior Recommendation},
  booktitle = {Proceedings of the 35th AAAI Conference on Artificial Intelligence, AAAI 2021, Online, February 2-9, 2021.},
  year      = {2021},
}

Environment

The codes of KHGT are implemented and tested under the following development environment:

  • python=3.6.12
  • tensorflow=1.14.0
  • numpy=1.16.0
  • scipy=1.5.2

Datasets

We employed three datasets to evaluate KHGT, i.e. Yelp, MovieLens, Online Retail. For Yelp and Movielens data, like behavior is taken as the target behavior, and purchase behavior is taken as the target behavior for the Online Retail data. The last target behavior for the test users are left out to compose the testing set. We filtered out users and items with too few interactions.

How to Run the Codes

Please unzip the datasets first. Also you need to create the History/ and the Models/ directories. The command to train KHGT is as follows. The commands specify the hyperparameter settings that generate the reported results in the paper. For Movielens and Online Retail data, we conducted sub-graph sampling to efficiently handle the large-scale multi-behavior user-item graphs.

  • Yelp
python labcode_yelp.py
  • MovieLens, training
python labcode_ml10m.py --data ml10m --graphSampleN 1000 --save_path model_name
  • MovieLens, testing
python labcode_ml10m.py --data ml10m --graphSampleN 5000 --epoch 0 --load_model model_name
  • Online Retail, training
python labcode_retail.py --data retail --graphSampleN 15000 --reg 1e-1 --save_path model_name
  • Online Retail, testing
python labcode_retail.py --data retail --graphSampleN 30000 --epoch 0 --load_model model_name

Important arguments:

  • reg: It is the weight for weight-decay regularization. We tune this hyperparameter from the set {1e-2, 5e-3, 1e-3, 5e-4, 1e-4, 5e-5, 1e-5}.

  • graphSampleN: It denotes the number of nodes to sample in each step of sub-graph sampling. It is tuned from the set {1000, 5000, 10000, 15000, 20000, 30000, 40000, 50000}

Acknowledgements

We thank the anonymous reviewers for their constructive feedback and comments. This work is supported by National Nature Science Foundation of China (62072188, 61672241), Natural Science Foundation of Guangdong Province (2016A030308013), Science and Technology Program of Guangdong Province (2019A050510010).

khgt's People

Contributors

akaxlh avatar anonymous0506x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

khgt's Issues

embedding of uEmbed0/iEmbed0 and UEmbedPred/IEmbedPred

Hello I have a question about embedding of uEmbed0/iEmbed0 and UEmbedPred/IEmbedPred.

In "ours" function, why Embed0 is replaced by a random initialized EmbedPred in code line 125~126 in labcode_ml10m.py?I didn't find a description of it in the paper, and I don't understand what the motivation is for doing so.

I am confused.

Anyway, thanks of the codes. It is pretty.

框架安装包版本

你好,您这个源码里面少放了安装包的版本,使用tensorflow的一些版本来跑程序的时候,一直出错。

Datasets problem

Dear author, I would like to ask you some problems in datasets
that is, the user of each dataset exceed 10000, but I found that only 10000 users in test data
For example, there are 67788 users in ML10M, but only 10000 users are chosen for test, is it reasonable?
Thanks!

The axis of softmax supposed to be 0?

def GAT(self, srcEmbeds, tgtEmbeds, tgtNodes, maxNum, Qs, Ks, Vs):
	QWeight = tf.nn.softmax(NNs.defineRandomNameParam([args.memosize, 1, 1], reg=True), axis=1)
	KWeight = tf.nn.softmax(NNs.defineRandomNameParam([args.memosize, 1, 1], reg=True), axis=1)
	VWeight = tf.nn.softmax(NNs.defineRandomNameParam([args.memosize, 1, 1], reg=True), axis=1)
	Q = tf.reduce_sum(Qs * QWeight, axis=0)
	K = tf.reduce_sum(Ks * KWeight, axis=0)
	V = tf.reduce_sum(Vs * VWeight, axis=0)

I found above code to implement equation (3), I have 2 questions:

  1. I think it should be below:
tf.nn.softmax(..., axis = 0) 
  1. For all behavior $k$, there supposed to be only 1 group of $Q^h_m, m = 1\cdots, M$ to aggregated from, according to equation (3). While in practical implementation, each behavior $k$ has its own $M$ channels basis parameters.

Please excuse me if there is any misunderstanding.

embedding of srcNodes and tgtNodes

Hello, I have a question. In the "messagePropagate" function, why do srcNodes and tgtNodes look up their embeddings in the same embedding table?

Issue run retail dataset

Hi, Thank you for your quick response.
I was unable to run the code on retail dataset. (and Successfully run the code on ml10m and yelp datasets )
BTW, I have fixed the following minor issues to enable the correctness:

  • change the folder name from 'Yelp' to 'yelp' (match the folder name in DataHandler_time.py)
  • change line 14 in DataHandler_time.py to 'retail' (instead of 'Tmall')

During the execution of

python labcode_retail.py --data retail --graphSampleN 15000 --reg 1e-1 --save_path model_name

The error pops out due to the index out of range. I think these are some issues with the dataset.
Please let me know if you could get it run.
And would you mind to sharing me the original data and data preprocessing code?

关于对比模型实验

作者您好!最近看了KHGT这篇论文觉得很有启发,但是在对比模型的实现上遇到了一些问题。请问能否发一份对比模型的代码,我的邮箱是[email protected]。如果可以的话,非常感谢!

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.