We propose Equivariant Contrastive Learning for Sequential Recommendation (ECL-SR), which endows SR models with great discriminative power, making the learned user behavior representations sensitive to invasive augmentations (e.g., item substitution) and insensitive to mild augmentations (e.g., feature-level dropout masking). In detail, we use the conditional discriminator to capture differences in behavior due to item substitution, which encourages the user behavior encoder to be equivariant to invasive augmentations.
Our code is based on PyTorch 1.8.1 and runnable for both windows and ubuntu server. Required python packages:
numpy==1.20.3 scipy==1.6.3 torch==1.8.1 tensorboard==2.7.0
Download datasets from RecSysDatasets or their Google Drive. And put the files in ./dataset/
like the following.
$ tree
.
├── Amazon_Toys_and_Games
│ ├── Amazon_Toys_and_Games.inter
│ └── Amazon_Toys_and_Games.item
├── Amazon_Sports_and_Outdoors
│ ├── Amazon_Sports_and_Outdoors.inter
│ └── Amazon_Sports_and_Outdoors.item
└── yelp
├── README.md
├── yelp.inter
├── yelp.item
└── yelp.user
See benchmarks folder to reproduce the results.
Due to some stochastic factors, slightly tuning the hyper-parameters using grid search is necessary if you want to reproduce the performance. If you have any question, please issue the project or email us and we will reply you soon.
If you find this repo useful, please cite
@inproceedings{zhou2023equivariant,
title={Equivariant contrastive learning for sequential recommendation},
author={Zhou, Peilin and Gao, Jingqi and Xie, Yueqi and Ye, Qichen and Hua, Yining and Kim, Jaeboum and Wang, Shoujin and Kim, Sunghun},
booktitle={Proceedings of the 17th ACM Conference on Recommender Systems},
pages={129--140},
year={2023}
}
The code is based on Recbole.
Feel free to contact us if there is any question. (Peilin Zhou, [email protected]; Jingqi Gao, [email protected]; YueqiXIE, [email protected];)
Code implementation for ECL and all baselines.