torch seq2rec
Data & Preprocess
diginetica
- Data Download
mkdir data/diginetica
- download the
dataset-train-diginetica.zip
from link - unzip the file and put
click-item-views.csv
is underdata/diginetica
folder
- Preprocess
- remove items with item_counts<=4
- remove ssessions with session_length=1
- use last week as testing data
yoochoose(1/4)
- Data Download
mkdir data/yoochoose
cd data/yoochoose
wget https://s3-eu-west-1.amazonaws.com/yc-rdata/yoochoose-data.7z
7z x yoochoose-data.7z -o./yoochoose-data
- Preprocess
- remove items with item_counts<=4
- remove ssessions with session_length=1
- sort sessions by timestamp and only keep last 1/4 sessions
- use last day as testing data
GRU4REC
Implementation
pip install -r model/gru4rec/requirements.txt
cd scripts
./run_gru4rec_[dataset_name].sh
This script will do
- preprocess the original data in
data
folder - save
train.csv
andtest.csv
inexp
folder - train gru4rec model
- evaluate the model with Recall & MRR & NDCG
SRGNN
Original code from here. Original paper.
preprocessing
python ./model/SRGNN/preprocess.py
Implementation
pip install -r ./model/SRGNN/requirement.txt
./script/run_SRGNN_[dataset_name].sh
sasRec
Paper
Wang-Cheng Kang, Julian McAuley (2018). Self-Attentive Sequential Recommendation. In Proceedings of IEEE International Conference on Data Mining (ICDM'18)
Implementation
cd script
./sasRec_yoochoose.sh
Preprocess
- Data Dowmload into data folder
- You need to run the file model/sasRec/DataProcess.py first to preprocess the data.
- data preprocess
python3 ./model/sasRec/DataProcessing.py --dataset=yoochoose
Run model
-you can run the file main.py or to train the model. For example:
python3 main.py --dataset=sample
-You can change other parameters according to the usage: if your dataset is from yoochoose
python3 ./model/sasRec/main.py --dataset=yoochoose