CIRS-codes 开源项目使用教程
1. 项目介绍
CIRS-codes 是一个基于 Pytorch 的开源实现,用于论文 "CIRS: Bursting Filter Bubbles by Counterfactual Interactive Recommender System"。该项目旨在通过反事实交互推荐系统来打破过滤气泡,提供了一种新的推荐系统方法。项目中包含了两个环境:VirtualTaobao 和 KuaishouEnv,用于评估推荐系统在不同场景下的表现。
2. 项目快速启动
2.1 环境准备
首先,克隆项目到本地:
git clone https://github.com/chongminggao/CIRS-codes.git
cd CIRS-codes
建议创建一个新的 conda 环境:
conda create --name CIRS python=3.9 -y
conda activate CIRS
安装所需的依赖:
sh install.sh
2.2 数据准备
下载并解压数据集:
wget https://zenodo.org/records/10448452/files/"environment data.zip"
unzip "environment data.zip"
mv environment\ data/KuaishouEnv/* environments/KuaishouRec/data/
mv environment\ data/VirtualTaobao/* environments/VirtualTaobao/virtualTB/SupervisedLearning/
2.3 运行示例
2.3.1 VirtualTaobao 环境
训练用户模型:
python3 CIRS-UserModel-taobao.py --cuda 0
使用训练好的用户模型规划 RL 策略:
python3 CIRS-RL-taobao.py --cuda 0 --epoch 100 --message "my-CIRS"
2.3.2 KuaishouEnv 环境
训练用户模型:
python3 CIRS-UserModel-kuaishou.py --cuda 0
使用训练好的用户模型规划 RL 策略:
python3 CIRS-RL-kuaishou.py --cuda 0 --epoch 100 --message "my-CIRS"
3. 应用案例和最佳实践
3.1 应用案例
CIRS-codes 项目可以应用于多种推荐系统场景,特别是在需要打破过滤气泡的情况下。例如,在电商平台的推荐系统中,可以使用该项目来提高推荐的多样性,避免用户陷入信息茧房。
3.2 最佳实践
- 数据预处理:在使用项目前,确保数据集已经正确下载并解压到指定目录。
- 参数调优:根据具体应用场景,调整训练和策略规划的参数,以获得最佳效果。
- 模型评估:在训练和策略规划完成后,使用评估脚本对模型进行评估,确保其性能符合预期。
4. 典型生态项目
4.1 DeepCTR-Torch
DeepCTR-Torch 是一个基于 Pytorch 的深度学习推荐系统库,CIRS-codes 项目中使用了该库的部分功能。DeepCTR-Torch 提供了多种推荐模型,可以与 CIRS-codes 结合使用,进一步提升推荐系统的性能。
4.2 Tianshou
Tianshou 是一个基于 Pytorch 的强化学习库,CIRS-codes 项目中使用了该库来实现强化学习策略。Tianshou 提供了丰富的强化学习算法,可以与 CIRS-codes 结合使用,实现更复杂的推荐策略。
通过以上模块的介绍和实践,您可以快速上手并应用 CIRS-codes 项目,实现高效的推荐系统。