GithubHelp home page GithubHelp logo

xu94-nlp / code-for-mamo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dongmanqing/code-for-mamo

0.0 0.0 0.0 1.34 MB

The code for paper MAMO: Memory-Augmented Meta-Optimization for Cold-start Recommendation

License: Apache License 2.0

Python 100.00%

code-for-mamo's Introduction

Code-for-MAMO

Code for paper MAMO: Memory-Augmented Meta-Optimization for Cold-start Recommendation.

Requirements

  • python 3.6+

Packages

  • pytorch
  • numpy
  • pandas

Dataset

  1. The raw datasets could be downloaded from:
  1. Put the dataset into the according data_raw folder.

  2. Create a folder named data_processed, you can process the raw datasets via python3 prepareDataset.py

Here we only give the processing code for the MovieLens dataset, please write your own code for processing Bookcrossing dataset with the similar functions presented in prepareMovielens.py

  1. The structure of the processed dataset:
- data_processed

  - bookcrossing
    - raw
      sample_1_x1.p
      sample_1_x2.p
      sample_1_y.p
      sample_1_y0.p
      ...
    item_dict.p
    item_state_ids.p
    ratings_sorted.p
    user_dict.p
    user_state_ids.p
   
  - movielens
    - raw
      sample_1_x1.p
      sample_1_x2.p
      sample_1_y.p
      sample_1_y0.p
      ...
    item_dict.p
    item_state_ids.p
    ratings_sorted.p
    user_dict.p
    user_state_ids.p

Model training

The structure of our code:

- prepare_data
  prepareBookcrossing.py
  prepareList.py
  prepareMovielens.py
- modules
  info_embedding.py
  input_loading.py
  memories.py
  rec_model.py
configs.py
mamoRec.py
models.py
prepareDataset.py
utils.py

Run the codes in mamoRec.py for training the model:

if __name__ == '__main__':
    MAMRec('movielens')

Some tips

  1. This version of code runs over all training or testing users, which may take about half an hour for one epoch on a Linux server with NVIDIA TITAN X. So you can revise the code for updating the parameters via batches of users and using parallel computing.

  2. You can del the used variables to save the computation cost. If you have any suggestions on saving the computation cost, I'm happy to receive your emails.

Citation

If you use this code, please consider to cite the following paper:

@inproceedings{dong2020mamo,
  title={MAMO: Memory-Augmented Meta-Optimization for Cold-start Recommendation},
  author={Manqing, Dong and Feng, Yuan and Lina, Yao and Xiwei, Xu and Liming, Zhu},
  booktitle={26th SIGKDD Conference on Knowledge Discovery and Data Mining},
  year={2020}
}

code-for-mamo's People

Contributors

dongmanqing avatar xu94-nlp 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.