GithubHelp home page GithubHelp logo

linxyhaha / cdr Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 1.0 20.1 MB

Causal Disentangled Recommendation Against Preference Shifts (TOIS), 2023

Home Page: https://arxiv.org/pdf/2303.16068.pdf

Python 98.90% Shell 1.10%
invariant-learning ood-generalization pytorch recommender-system

cdr's Introduction

Causal Disentangled Recommendation Against Preference Shifts

This is the pytorch implementation of our paper

Causal Disentangled Recommendation Against Preference Shifts

Environment

  • Anaconda 3
  • python 3.7.3
  • pytorch 1.4.0
  • numpy 1.16.4

Usage

Data

The experimental data are in './data' folder, including Yelp, Book and Electronics.

Training

python main.py --dataset=$1 --lr=$2 --batch_size=$3 --mlp_dims=$4 --mlp_p1_dims=$5 --mlp_p2_dims=$6 --a_dims=$7 --z_dims=$8 --c_dims=$9 --tau=$10 --T=$11 --lam1=$12 --lam2=$13 --lam3=$14 --regs=$15 --bn=$16 --dropout=$17 --std=$18 --add_T=$19 --log_name=$20 --gpu=$21 --cuda

or use run.sh

sh run.sh model_name dataset lr batch_size mlp_dims mlp_p1_dims mlp_p2_dims a_dims z_dims c_dims tau T lam1 lam2 lam3 regs bn dropout std add_T log_name gpu_id
  • The log file will be in the './code/log/' folder.
  • The explanation of hyper-parameters can be found in './code/main.py'.
  • The default hyper-parameter settings are detailed in './code/hyper-parameters.txt'.

Inference

Get the results of CDR over three datasets by running inference.py:

python inference.py --dataset=$1 --T=$2 --add_T=$3 --ckpt=$4 --gpu=$5 --cuda

Examples

  1. Train CDR on Yelp:
cd ./code
sh run.sh yelp 1e-4 500 [800] [] [] 400 400 2 0.5 3 0.5 1 0.0001 0 1 0.6 1 2 log 0
  1. Inference on Book:
cd ./code
python inference.py --dataset book --T 3 --add_T 3 --ckpt <pre-trained model directory> --gpu 0 --cuda

cdr's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

gaoming-wang

cdr's Issues

关于代码中变量使用的问题

作者您好,最近正在阅读你们的工作。但是在运行代码时,我发现这两个变量似乎并没有在下面的代码中使用到,那这里加载的意义是什么呢?
c64e022ca4a87cf03d883e594698b10

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.