{"id":13958320,"url":"https://github.com/CRIPAC-DIG/SR-GNN","last_synced_at":"2025-07-20T23:31:00.521Z","repository":{"id":44443485,"uuid":"157193186","full_name":"CRIPAC-DIG/SR-GNN","owner":"CRIPAC-DIG","description":"[AAAI 2019] Source code and datasets for \"Session-based Recommendation with Graph Neural Networks\"","archived":true,"fork":false,"pushed_at":"2021-11-12T07:45:36.000Z","size":130,"stargazers_count":816,"open_issues_count":6,"forks_count":270,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-08-09T13:18:33.554Z","etag":null,"topics":["graph-neural-networks","machine-learning","recommender-systems","session-based-recommendation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CRIPAC-DIG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-12T10:04:32.000Z","updated_at":"2024-08-08T14:59:21.000Z","dependencies_parsed_at":"2022-07-13T02:50:27.377Z","dependency_job_id":null,"html_url":"https://github.com/CRIPAC-DIG/SR-GNN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CRIPAC-DIG%2FSR-GNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CRIPAC-DIG%2FSR-GNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CRIPAC-DIG%2FSR-GNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CRIPAC-DIG%2FSR-GNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CRIPAC-DIG","download_url":"https://codeload.github.com/CRIPAC-DIG/SR-GNN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226844975,"owners_count":17691137,"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":["graph-neural-networks","machine-learning","recommender-systems","session-based-recommendation"],"created_at":"2024-08-08T13:01:29.488Z","updated_at":"2024-11-28T01:31:42.086Z","avatar_url":"https://github.com/CRIPAC-DIG.png","language":"Python","funding_links":[],"categories":["其他_推荐系统"],"sub_categories":["网络服务_其他"],"readme":"# SR-GNN\n\n## Paper data and code\n\nThis is the code for the AAAI 2019 Paper: [Session-based Recommendation with Graph Neural Networks](https://arxiv.org/abs/1811.00855). We have implemented our methods in both **Tensorflow** and **Pytorch**.\n\nHere are two datasets we used in our paper. After downloaded the datasets, you can put them in the folder `datasets/`:\n\n- YOOCHOOSE: \u003chttp://2015.recsyschallenge.com/challenge.html\u003e or \u003chttps://www.kaggle.com/chadgostopp/recsys-challenge-2015\u003e\n\n- DIGINETICA: \u003chttp://cikm2016.cs.iupui.edu/cikm-cup\u003e or \u003chttps://competitions.codalab.org/competitions/11161\u003e\n\nThere is a small dataset `sample` included in the folder `datasets/`, which can be used to test the correctness of the code.\n\nWe have also written a [blog](https://sxkdz.github.io/research/SR-GNN) explaining the paper.\n\n## Usage\n\nYou need to run the file  `datasets/preprocess.py` first to preprocess the data.\n\nFor example: `cd datasets; python preprocess.py --dataset=sample`\n\n```bash\nusage: preprocess.py [-h] [--dataset DATASET]\n\noptional arguments:\n  -h, --help         show this help message and exit\n  --dataset DATASET  dataset name: diginetica/yoochoose/sample\n```\n\nThen you can run the file `pytorch_code/main.py` or `tensorflow_code/main.py` to train the model.\n\nFor example: `cd pytorch_code; python main.py --dataset=sample`\n\nYou can add the suffix `--nonhybrid` to use the global preference of a session graph to recommend instead of the hybrid preference.\n\nYou can also change other parameters according to the usage:\n\n```bash\nusage: main.py [-h] [--dataset DATASET] [--batchSize BATCHSIZE]\n               [--hiddenSize HIDDENSIZE] [--epoch EPOCH] [--lr LR]\n               [--lr_dc LR_DC] [--lr_dc_step LR_DC_STEP] [--l2 L2]\n               [--step STEP] [--patience PATIENCE] [--nonhybrid]\n               [--validation] [--valid_portion VALID_PORTION]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --dataset DATASET     dataset name:\n                        diginetica/yoochoose1_4/yoochoose1_64/sample\n  --batchSize BATCHSIZE\n                        input batch size\n  --hiddenSize HIDDENSIZE\n                        hidden state size\n  --epoch EPOCH         the number of epochs to train for\n  --lr LR               learning rate\n  --lr_dc LR_DC         learning rate decay rate\n  --lr_dc_step LR_DC_STEP\n                        the number of epochs after which the learning rate\n                        decay\n  --l2 L2               l2 penalty\n  --step STEP           gnn propogation steps\n  --patience PATIENCE   the number of epoch to wait before early stop\n  --nonhybrid           only use the global preference to predict\n  --validation          validation\n  --valid_portion VALID_PORTION\n                        split the portion of training set as validation set\n```\n\n## Requirements\n\n- Python 3\n- PyTorch 0.4.0 or Tensorflow 1.9.0\n\n## Other Implementation for Reference\nThere are other implementation available for reference:\n- Implementation based on PaddlePaddle by Baidu [[Link]](https://github.com/PaddlePaddle/models/tree/develop/PaddleRec/gnn)\n- Implementation based on PyTorch Geometric [[Link]](https://github.com/RuihongQiu/SR-GNN_PyTorch-Geometric)\n- Another implementation based on Tensorflow [[Link]](https://github.com/jimanvlad/SR-GNN)\n- Yet another implementation based on Tensorflow [[Link]](https://github.com/loserChen/TensorFlow-In-Practice/tree/master/SRGNN)\n\n## Citation\n\nPlease cite our paper if you use the code:\n\n```\n@inproceedings{Wu:2019ke,\ntitle = {{Session-based Recommendation with Graph Neural Networks}},\nauthor = {Wu, Shu and Tang, Yuyuan and Zhu, Yanqiao and Wang, Liang and Xie, Xing and Tan, Tieniu},\nyear = 2019,\nbooktitle = {Proceedings of the Twenty-Third AAAI Conference on Artificial Intelligence},\nlocation = {Honolulu, HI, USA},\nmonth = jul,\nvolume = 33,\nnumber = 1,\nseries = {AAAI '19},\npages = {346--353},\nurl = {https://aaai.org/ojs/index.php/AAAI/article/view/3804},\ndoi = {10.1609/aaai.v33i01.3301346},\neditor = {Pascal Van Hentenryck and Zhi-Hua Zhou},\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCRIPAC-DIG%2FSR-GNN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCRIPAC-DIG%2FSR-GNN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCRIPAC-DIG%2FSR-GNN/lists"}