Skip to content
/ HGN Public

Hierarchical Gating Networks for Sequential Recommendation

License

Notifications You must be signed in to change notification settings

allenjack/HGN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The HGN model for Sequential Recommendation

The implementation of the paper:

Chen Ma, Peng Kang, and Xue Liu, "Hierarchical Gating Networks for Sequential Recommendation", in the 25th ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD 2019)

Arxiv: https://arxiv.org/abs/1906.09217

Please cite our paper if you use our code. Thanks!

Author: Chen Ma (allenmc1230@gmail.com)

Feel free to send me an email if you have any questions.

Bibtex

@inproceedings{DBLP:conf/kdd/MaKL19,
  author    = {Chen Ma and
               Peng Kang and
               Xue Liu},
  title     = {Hierarchical Gating Networks for Sequential Recommendation},
  booktitle = {{KDD}},
  pages     = {825--833},
  publisher = {{ACM}},
  year      = {2019}
}

Environments

  • python 3.6
  • PyTorch (version: 1.0.0)
  • numpy (version: 1.15.0)
  • scipy (version: 1.1.0)
  • sklearn (version: 0.19.1)

Dataset

In our experiments, the movielens-20M dataset is from https://grouplens.org/datasets/movielens/20m/, the Amazon-CDs and Amazon-Books datasets are from http://jmcauley.ucsd.edu/data/amazon/, the GoodReads-Children and GoodReads-Comics datasets are from https://sites.google.com/eng.ucsd.edu/ucsdbookgraph/home. (If you need the data after preprocessing, please send me an email check this Google Drive link).

The XXX_tem_sequences.pkl file is a list of lists that stores the inner item id of each user in a chronological order, e.g., user_records[0]=[item_id0, item_id1, item_id2,...].

The XXX_user_mapping.pkl file is a list that maps the user inner id to its original id, e.g., user_mapping[0]=A2SUAM1J3GNN3B.

The XXX_item_mapping.pkl file is similar to XXX_user_mapping.pkl.

Example to run the code

Data preprocessing:

The code for data preprocessing is put in the /preprocessing folder. Amazon_CDs.ipynb provides an example on how to transform the raw data into the .pickle files that used in our program.

Train and evaluate the model (you are strongly recommended to run the program on a machine with GPU):

python run.py

Another implementation

Kindly thank Liwei Wu for another implementation with a different evaluation strategy: https://github.com/wuliwei9278/HGN_baseline.

Acknowledgment

The sequence segmentation (interactions.py) is heavily built on Spotlight. Thanks for the amazing work.

About

Hierarchical Gating Networks for Sequential Recommendation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published