# SR-GNN
## Paper data and code
This 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**.
Here are two datasets we used in our paper. After downloaded the datasets, you can put them in the folder `datasets/`:
- YOOCHOOSE: <http://2015.recsyschallenge.com/challenge.html> or <https://www.kaggle.com/chadgostopp/recsys-challenge-2015>
- DIGINETICA: <http://cikm2016.cs.iupui.edu/cikm-cup> or <https://competitions.codalab.org/competitions/11161>
There is a small dataset `sample` included in the folder `datasets/`, which can be used to test the correctness of the code.
We have also written a [blog](https://sxkdz.github.io/research/SR-GNN) explaining the paper.
## Usage
You need to run the file `datasets/preprocess.py` first to preprocess the data.
For example: `cd datasets; python preprocess.py --dataset=sample`
```bash
usage: preprocess.py [-h] [--dataset DATASET]
optional arguments:
-h, --help show this help message and exit
--dataset DATASET dataset name: diginetica/yoochoose/sample
```
Then you can run the file `pytorch_code/main.py` or `tensorflow_code/main.py` to train the model.
For example: `cd pytorch_code; python main.py --dataset=sample`
You can add the suffix `--nonhybrid` to use the global preference of a session graph to recommend instead of the hybrid preference.
You can also change other parameters according to the usage:
```bash
usage: main.py [-h] [--dataset DATASET] [--batchSize BATCHSIZE]
[--hiddenSize HIDDENSIZE] [--epoch EPOCH] [--lr LR]
[--lr_dc LR_DC] [--lr_dc_step LR_DC_STEP] [--l2 L2]
[--step STEP] [--patience PATIENCE] [--nonhybrid]
[--validation] [--valid_portion VALID_PORTION]
optional arguments:
-h, --help show this help message and exit
--dataset DATASET dataset name:
diginetica/yoochoose1_4/yoochoose1_64/sample
--batchSize BATCHSIZE
input batch size
--hiddenSize HIDDENSIZE
hidden state size
--epoch EPOCH the number of epochs to train for
--lr LR learning rate
--lr_dc LR_DC learning rate decay rate
--lr_dc_step LR_DC_STEP
the number of epochs after which the learning rate
decay
--l2 L2 l2 penalty
--step STEP gnn propogation steps
--patience PATIENCE the number of epoch to wait before early stop
--nonhybrid only use the global preference to predict
--validation validation
--valid_portion VALID_PORTION
split the portion of training set as validation set
```
## Requirements
- Python 3
- PyTorch 0.4.0 or Tensorflow 1.9.0
## Other Implementation for Reference
There are other implementation available for reference:
- Implementation based on PaddlePaddle by Baidu [[Link]](https://github.com/PaddlePaddle/models/tree/develop/PaddleRec/gnn)
- Implementation based on PyTorch Geometric [[Link]](https://github.com/RuihongQiu/SR-GNN_PyTorch-Geometric)
- Another implementation based on Tensorflow [[Link]](https://github.com/jimanvlad/SR-GNN)
- Yet another implementation based on Tensorflow [[Link]](https://github.com/loserChen/TensorFlow-In-Practice/tree/master/SRGNN)
## Citation
Please cite our paper if you use the code:
```
@inproceedings{Wu:2019ke,
title = {{Session-based Recommendation with Graph Neural Networks}},
author = {Wu, Shu and Tang, Yuyuan and Zhu, Yanqiao and Wang, Liang and Xie, Xing and Tan, Tieniu},
year = 2019,
booktitle = {Proceedings of the Twenty-Third AAAI Conference on Artificial Intelligence},
location = {Honolulu, HI, USA},
month = jul,
volume = 33,
number = 1,
series = {AAAI '19},
pages = {346--353},
url = {https://aaai.org/ojs/index.php/AAAI/article/view/3804},
doi = {10.1609/aaai.v33i01.3301346},
editor = {Pascal Van Hentenryck and Zhi-Hua Zhou},
}
```
基于图神经网络的会话推荐内含数据集和教程.zip
版权申诉
176 浏览量
2023-12-20
13:52:57
上传
评论
收藏 121KB ZIP 举报
小码蚁.
- 粉丝: 2526
- 资源: 4089
最新资源
- SVID_20240523_141155_1.mp4
- Code for the complete guide to tkinter tutorial
- 关于百货中心供应链管理系统.zip
- SimpleFolderIcon-master 修改Unity的Project下的文件夹图标
- A python Tkinter widget to display tile based maps
- A pure Python library for adding tables to a Tkinter application
- Vector资源文件.zip
- MobaXterm-Installer
- MicroMsg.xlsx
- 88-520告白(520气球).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈