Source code for KDD 2018 paper "Leverage Meta-path based Context for Top-N Recommendation with a Neural Co-Attention Model"
numpy
scipy
Tensorflow-gpu (1.2.1) or Theano (1.0.1)
Keras (2.1.1)
My machine with two GPUs (NVIDIA GTX-1080 2) and two CPUs (Intel Xeon E5-2690 2)
@inproceedings{
author = {Binbin Hu, Chuan Shi, Wayne Xin Zhao and Philip S. Yu.},
title = {Leverage Meta-path based Context for Top-N Recommendation with a Neural Co-Attention Model},
booktitle = {Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining},
year = {2018},
url = {https://dl.acm.org/citation.cfm?id=3219965},
publisher = {ACM},
address = {London, United Kingdom},
keywords = {Recommender System, Heterogeneous Information Network, Deep Learning, Attention Mechanism},
}
Dataset
We provide one processed dataset : MovieLens 100k (ml-100k). For each user, we treat the latest interaction as the test set and remaining data for training. Besides, we randomly select 50 movies that are not interacted by the user and rank the test movie amongst the 50 movies.
train.rating:
test.rating:
test.negative
Metapath Construction
The data we utilize is located in HIN Datasets or you can obtain it by executing the dataProcessing.py.
python dataProcessing.py
Run metapath construction :
The metapathbasedPathSampleForMovielens.py constructs different meta-paths for the following model training.
python metapathbasedPathSampleForMovielens.py --walk_num 5 --metapath umtm
Here,
uafile : user_age.dat , which extracts from original u.user,
0~10 : 1; 11 ~20 : 2; 21~30 : 3; 31~40 : 4;41~50 : 5; 51~60 : 6
uofile : user_occupation.dat, which is the relation between u.user and u.occupation
mtfile : movie_genre.dat, which the relation between u.user and u.genre
uufile : user_user(knn).dat
mmfile : movie_movie(knn).dat
Output:
Example to run the codes.
The parameter setting is set on line 476-484 of file MCRec, and the dataset for which is Movielens-100K. Be sure to refer to it while experimenting with different datasets.
Run MCRec:
python MCRec.py --dataset ml-100k --epochs 30 --batch_size 256 --learner adam --lr 0.001 --latent_dim 128 --latent_layer_dim [512, 256, 128, 64] --num_neg 4
Remarkable