Code Monkey home page Code Monkey logo

tdro's Introduction

Temporally and Distributionally Robust Optimization for Cold-start Recommendation

💡 This is the pytorch implementation of our paper

Temporally and Distributionally Robust Optimization for Cold-start Recommendation

Xinyu Lin, Wenjie Wang, Jujia Zhao, Yongqi Li, Fuli Feng, Tat-Seng Chua

Environment

  • Anaconda 3
  • python 3.7.11
  • pytorch 1.10.0
  • numpy 1.21.4
  • kmeans_pytorch

Usage

Data

The experimental data are in './data' folder, including Amazon, Micro-video, and Kwai.

🔴 Training

python main.py --model_name=$1 --data_path=$2 --batch_size=$3 --l_r=$4 --reg_weight=$5 --num_group=$6 --num_period=$7 --mu=$8 --eta=$9 --lam=$10 --split_mode=$11 --log_name=$12 --gpu=$13

or use run.sh

sh run.sh <model_name> <dataset> <batch_size> <lr> <reg_weight> <num_group> <num_period> <mu> <eta> <lam> <split_mode> <logname> <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'.

🌟 TDRO is a model-agnostic training framework and can be applied to any cold-start recommender model. You can simply create your cold-start recommender model script in './code' folder, in a similar way to "model_CLCRec.py". Alternatively, you may adopt the function train_TDRO in "Train.py" to your own code for training your cold-start recommender model via TDRO.

🔵 Inference

Get the results of TDRO by running inference.py:

python inference.py --inference --data_path=$1 --ckpt=$2 --gpu=$3

or use inference.sh

sh inference.sh dataset <ckpt_path> <gpu_id>

⚪ Examples

  1. Train on Amazon dataset
cd ./code
sh run.sh TDRO amazon 1000 0.001 0.001 5 5 0.2 0.2 0.3 global log 0
  1. Inference
cd ./code
sh inference.sh amazon <ckpt_path> 0

Citation

If you find our work is useful for your research, please consider citing:

@inproceedings{lin2023temporally,
      title={Temporally and Distributionally Robust Optimization for Cold-start Recommendation}, 
      author={Xinyu Lin, Wenjie Wang, Jujia Zhao, Yongqi Li, Fuli Feng, and Tat-Seng Chua},
      booktitle={AAAI},
      year={2024}
}

License

NUS © NExT++

tdro's People

Contributors

linxyhaha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tdro's Issues

inference.py报错

Hello author, I am currently reproducing your TDRO model code, but I found an unnecessary parameter num_period in the train_dataset function call at line 117 in the original inference.py, whether I deleted the parameter or added it in Dataset.py An error will be reported, or the --no_cuda option is not defined, or there is an error in the eval() function, etc. How should I solve it?

new dataset

Thank you very much for your timely help. The problem of the previous dataset has been solved, and now I have encountered two problems again. I really hope to get your help.
First of all, I ran it on my computer, and found that there were certain errors in the results of amazon data sets and kwai data sets compared with those in the paper. Mainly in the hot project and the overall project, the results were lower than those in the paper.
Secondly, I would like to run on new data sets, could you provide some data set processing methods?
Thank you so much.

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.