make other meta-learning algorithms implemented in l2l.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 4.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # MeLU: Meta-Learned User Preference Estimator for Cold-Start Recommendation
  2. PyTorch implementation of the paper: "MeLU: Meta-Learned User Preference Estimator for Cold-Start Recommendation", KDD, 2019.
  3. ## Abstract
  4. This paper proposes a recommender system to alleviate the coldstart problem that can estimate user preferences based on only a small number of items. To identify a user’s preference in the cold state, existing recommender systems, such as Netflix, initially provide items to a user; we call those items evidence candidates. Recommendations are then made based on the items selected by the user. Previous recommendation studies have two limitations: (1) the users who consumed a few items have poor recommendations and (2) inadequate evidence candidates are used to identify user preferences. We propose a meta-learning-based recommender system called MeLU to overcome these two limitations. From metalearning, which can rapidly adopt new task with a few examples, MeLU can estimate new user’s preferences with a few consumed items. In addition, we provide an evidence candidate selection strategy that determines distinguishing items for customized preference estimation. We validate MeLU with two benchmark datasets, and the proposed model reduces at least 5.92% mean absolute error than two comparative models on the datasets. We also conduct a user study experiment to verify the evidence selection strategy.
  5. ## Usage
  6. ### Requirements
  7. - python 3.6+
  8. - pytorch 1.1+
  9. - tqdm 4.32+
  10. - pandas 0.24+
  11. ### Preparing dataset
  12. It needs about 22GB of hard disk space.
  13. ```python
  14. import os
  15. from data_generation import generate
  16. master_path= "./ml"
  17. if not os.path.exists("{}/".format(master_path)):
  18. os.mkdir("{}/".format(master_path))
  19. generate(master_path)
  20. ```
  21. ### Training a model
  22. Our model needs support and query sets. The support set is for local update, and the query set is for global update.
  23. ```python
  24. import torch
  25. import pickle
  26. from MeLU import MeLU
  27. from options import config
  28. from model_training import training
  29. melu = MeLU(config)
  30. model_filename = "{}/models.pkl".format(master_path)
  31. if not os.path.exists(model_filename):
  32. # Load training dataset.
  33. training_set_size = int(len(os.listdir("{}/warm_state".format(master_path))) / 4)
  34. supp_xs_s = []
  35. supp_ys_s = []
  36. query_xs_s = []
  37. query_ys_s = []
  38. for idx in range(training_set_size):
  39. supp_xs_s.append(pickle.load(open("{}/warm_state/supp_x_{}.pkl".format(master_path, idx), "rb")))
  40. supp_ys_s.append(pickle.load(open("{}/warm_state/supp_y_{}.pkl".format(master_path, idx), "rb")))
  41. query_xs_s.append(pickle.load(open("{}/warm_state/query_x_{}.pkl".format(master_path, idx), "rb")))
  42. query_ys_s.append(pickle.load(open("{}/warm_state/query_y_{}.pkl".format(master_path, idx), "rb")))
  43. total_dataset = list(zip(supp_xs_s, supp_ys_s, query_xs_s, query_ys_s))
  44. del(supp_xs_s, supp_ys_s, query_xs_s, query_ys_s)
  45. training(melu, total_dataset, batch_size=config['batch_size'], num_epoch=config['num_epoch'], model_save=True, model_filename=model_filename)
  46. else:
  47. trained_state_dict = torch.load(model_filename)
  48. melu.load_state_dict(trained_state_dict)
  49. ```
  50. ### Extracting evidence candidates
  51. We extract evidence candidate list based on the MeLU.
  52. ```python
  53. from evidence_candidate import selection
  54. evidence_candidate_list = selection(melu, master_path, config['num_candidate'])
  55. for movie, score in evidence_candidate_list:
  56. print(movie, score)
  57. ```
  58. Note that, you may have a different evidence candidate list from the paper. That's because we do not open the random seeds of data generation and model training.
  59. ## Citation
  60. If you use this code, please cite the paper.
  61. ```
  62. @inproceedings{lee2019melu,
  63. title={MeLU: Meta-Learned User Preference Estimator for Cold-Start Recommendation},
  64. author={Lee, Hoyeop and Im, Jinbae and Jang, Seongwon and Cho, Hyunsouk and Chung, Sehee},
  65. booktitle={Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery \& Data Mining},
  66. pages={1073--1082},
  67. year={2019},
  68. organization={ACM}
  69. }
  70. ```