{"id":13958305,"url":"https://github.com/allenjack/HGN","last_synced_at":"2025-07-20T23:30:56.401Z","repository":{"id":201864603,"uuid":"186724802","full_name":"allenjack/HGN","owner":"allenjack","description":"Hierarchical Gating Networks for Sequential Recommendation","archived":false,"fork":false,"pushed_at":"2021-10-19T09:17:42.000Z","size":20823,"stargazers_count":140,"open_issues_count":0,"forks_count":23,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-09T13:18:27.367Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allenjack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-05-15T01:10:38.000Z","updated_at":"2024-07-24T03:13:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"6822e4d4-e0dd-4c7c-9b55-96b284c5fa3e","html_url":"https://github.com/allenjack/HGN","commit_stats":null,"previous_names":["allenjack/hgn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenjack%2FHGN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenjack%2FHGN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenjack%2FHGN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenjack%2FHGN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allenjack","download_url":"https://codeload.github.com/allenjack/HGN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226844957,"owners_count":17691135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-08T13:01:29.163Z","updated_at":"2024-11-28T01:31:35.293Z","avatar_url":"https://github.com/allenjack.png","language":"Jupyter Notebook","funding_links":[],"categories":["其他_推荐系统"],"sub_categories":["网络服务_其他"],"readme":"# The HGN model for Sequential Recommendation\nThe implementation of the paper:\n\n*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**)* \n\nArxiv: https://arxiv.org/abs/1906.09217\n\n**Please cite our paper if you use our code. Thanks!**\n\nAuthor: Chen Ma (allenmc1230@gmail.com)\n\n**Feel free to send me an email if you have any questions.**\n\n**Bibtex**\n```\n@inproceedings{DBLP:conf/kdd/MaKL19,\n  author    = {Chen Ma and\n               Peng Kang and\n               Xue Liu},\n  title     = {Hierarchical Gating Networks for Sequential Recommendation},\n  booktitle = {{KDD}},\n  pages     = {825--833},\n  publisher = {{ACM}},\n  year      = {2019}\n}\n```\n\n## Environments\n\n- python 3.6\n- PyTorch (version: 1.0.0)\n- numpy (version: 1.15.0)\n- scipy (version: 1.1.0)\n- sklearn (version: 0.19.1)\n\n\n## Dataset\n\nIn 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](https://drive.google.com/file/d/1fPTpXFActieWBjowJpAF0YzctFHALCp3/view?usp=sharing)).\n\nThe ```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,...]```.\n\nThe ```XXX_user_mapping.pkl``` file is a list that maps the user inner id to its original id, e.g., ```user_mapping[0]=A2SUAM1J3GNN3B```.\n\nThe ```XXX_item_mapping.pkl``` file is similar to ```XXX_user_mapping.pkl```.\n\n## Example to run the code\n\nData preprocessing:\n\nThe 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.\n\nTrain and evaluate the model (you are strongly recommended to run the program on a machine with GPU):\n\n```\npython run.py\n```\n\n## Another implementation\n\nKindly thank [Liwei Wu](https://github.com/wuliwei9278) for another implementation with a different evaluation strategy: https://github.com/wuliwei9278/HGN_baseline.\n\n## Acknowledgment\nThe sequence segmentation (interactions.py) is heavily built on [Spotlight](https://github.com/maciejkula/spotlight). Thanks for the amazing work.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallenjack%2FHGN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallenjack%2FHGN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallenjack%2FHGN/lists"}