Giter VIP home page Giter VIP logo

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

code-for-mamo's Issues

About the data processing process to get 4 sub-datasets

Hi, I'm reading your paper MAMO and try to follow the experiment.
However, I have a question about the data processing process. In the function data_generation() in prepareDataset.py, it seems that all items of one user are mixed, whether it is warm or cold. Is further processing required to get 4 sub-datasets? And the training process doesn't seem to differentiate between the four statuses. If could, can you show the further data processing process and update the code?

Looking forward to your reply.

Question about Video memory usage

i have read the paper of MAMO. it's a great work.Video memory usage increases with the increase of tasks, even if I delete some useless variables。After my debugging, I found that modifying the 《user_mem_init》 function in the model module can avoid this problem。

with torch.no_grad():
   pu = loading_model(u_x1)
   personalized_bias_term,` att_values = feature_mem.read_head(pu, alpha)

Question about the experiments result.

image
hello,
i have read the paper of MAMO. it's a great work. but i still have some question about it.
in this paper, you said “We can see that our method shows stable and well performance in different scenarios, which shows the effectiveness of the meta-augmented meta-optimization strategy: learning a personalized initialization of local parameters from the memories.”, but in the Table 1, i found the result of MAMO is not always better than other baseline.
thanks for your reading and looking forward to your reply.

Are the 4 scenarios for only testing or training?

Hi, I have read the paper MAMO and found it an interesting and novel paper.
Now I'm trying to reproduce it but not sure whether the 4 scenarios, including WW, WC, CW, CC, are used for training or not. If for training, the number of training samples will be too small for CW and CC scenarios. If only for testing, does that mean training on mixed setting and testing on separate settings?

Looking forward to your reply.

support for multi attribute user features

Hi,
Like movie can have multiple genre and they are supported by the model, however i didnt find reference in code where the model provides support for such features(multi attribute) for users also. Can you pls elaborate if model support such user features?

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.