Code Monkey home page Code Monkey logo

cirs-codes's Introduction

Counterfactual Interactive Recommender System (CIRS)

LICENSE Python PyTorch

This repository contains the official Pytorch implementation for the paper CIRS: Bursting Filter Bubbles by Counterfactual Interactive Recommender System. It also contains the two environments in the paper: VirtualTaobao (with the leave mechanism altered to penalize filter bubbles) and the proposed KuaishouEnv.

introduction

More descriptions are available via the paper and this slides.

If this work helps you, please kindly cite our papers:

@article{gao2022cirs,
  title = {CIRS: Bursting Filter Bubbles by Counterfactual Interactive Recommender System},
  author = {Gao, Chongming and Lei, Wenqiang and Chen, Jiawei and Wang, Shiqi and He, Xiangnan and Li, Shijun and Li, Biao and Zhang, Yuan and Jiang, Peng},
  journal={arXiv preprint arXiv:2204.01266},
  year={2022}
}

@article{gao2022kuairec,
  title={KuaiRec: A Fully-observed Dataset for Recommender Systems},
  author={Gao, Chongming and Li, Shijun and Lei, Wenqiang and Li, Biao and Jiang, Peng and Chen, Jiawei and He, Xiangnan and Mao, Jiaxin and Chua, Tat-Seng},
  journal={arXiv preprint arXiv:2202.10842},
  year={2022}
}

Two environments for evaluating filter bubbles in interactive recommendation.

  • VirtualTaobao

The details of VirtualTaobao can be referred to this repository. Note that we alter the exit mechanism to penalize filter bubbles. Specifically, in the original VirtualTaobao environment the length of interaction trajectory is fixed and predicted in advance, we change it so that the interaction will be terminated when the recommended items repeat in a short time.

Exiting mechanism: We compute the Euclidean distance between the recommended target and the most recent $N$ recommended items. If any of them is lower than the threshold $d_Q$, the environment will quit the interaction process as the real users can get bored and quit given the tedious recommendation.

  • KuaishouEnv

KuaishouEnv is created by us in this project to evaluate interactive recommenders in video recommendation on Kuaishou, a video-sharing mobile App. Unlike VirtualTaobao which simulates real users by training a model on Taobao data, we use real user historical feedback in our environment.

It contains two matrices: big matrix and small matrix, where the latter is a fully filled user-item matrix. The statistics are shown in the following table. The details of data collection can be referred to the KuaiRec dataset (Webpage, Paper).

KuaishouEnv

Exiting mechanism: For the most recent $N$ recommended items, if more than the threshold $n_Q$ items have at least one attribute of the currently recommended target, then the environment ends the interaction process.

exit


Installation

  1. Clone this git repository and change directory to this repository:

    git clone [email protected]:chongminggao/CIRS-codes.git
    cd CIRS-codes
  2. A new conda environment is suggested.

    conda create --name CIRS python=3.9 -y
  3. Activate the newly created environment.

    conda activate CIRS
  4. Install the required

    sh install.sh

Note that the implementation requires two platforms, DeepCTR-Torch and Tianshou. The codes of the two platforms have already been included in this repository and are altered here and there.

Download the data

  1. Download the compressed dataset

    wget https://linux.chongminggao.top/CIRS/environment%20data.zip

(Download options: If the download via wget is too slow, you can manually download the file to the root path of this repository)

  1. Uncompress the downloaded environment data.zip and put the files to their corresponding positions.

    unzip "environment data.zip"
    mv environment\ data/KuaishouEnv/* environments/KuaishouRec/data/
    mv environment\ data/VirtualTaobao/* environments/VirtualTaobao/virtualTB/SupervisedLearning/

If things go well, you can run the following examples now.


Examples to run the code

The following commands only give one argument --cuda 0 as an example. For more arguments, please kindly refer to the paper and the definitions in the code files.

  • VirtualTaobao

  1. Train the user model on historical logs

    python3 CIRS-UserModel-taobao.py --cuda 0
  2. Plan the RL policy using a trained user model

    python3 CIRS-RL-taobao.py --cuda 0 --epoch 100 --message "my-CIRS"

  • KuaishouEnv

  1. Train the user model on historical logs

    python3 CIRS-UserModel-kuaishou.py --cuda 0
  2. Plan the RL policy using trained user model

    python3 CIRS-RL-kuaishou.py --cuda 0 --epoch 100 --message "my-CIRS"

Main Contributors

pic
Chongming Gao

USTC
(中科大)

pic
Shiqi Wang

Chongqing University
(重庆大学)

cirs-codes's People

Contributors

chongminggao avatar strawberry47 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.