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.

dataset.py 1.2KB

123456789101112131415161718192021222324252627282930
  1. import datetime
  2. import pandas as pd
  3. class movielens_1m(object):
  4. def __init__(self):
  5. self.user_data, self.item_data, self.score_data = self.load()
  6. def load(self):
  7. path = "movielens/ml-1m"
  8. profile_data_path = "{}/users.dat".format(path)
  9. score_data_path = "{}/ratings.dat".format(path)
  10. item_data_path = "{}/movies_extrainfos.dat".format(path)
  11. profile_data = pd.read_csv(
  12. profile_data_path, names=['user_id', 'gender', 'age', 'occupation_code', 'zip'],
  13. sep="::", engine='python'
  14. )
  15. item_data = pd.read_csv(
  16. item_data_path, names=['movie_id', 'title', 'year', 'rate', 'released', 'genre', 'director', 'writer', 'actors', 'plot', 'poster'],
  17. sep="::", engine='python', encoding="utf-8"
  18. )
  19. score_data = pd.read_csv(
  20. score_data_path, names=['user_id', 'movie_id', 'rating', 'timestamp'],
  21. sep="::", engine='python'
  22. )
  23. score_data['time'] = score_data["timestamp"].map(lambda x: datetime.datetime.fromtimestamp(x))
  24. score_data = score_data.drop(["timestamp"], axis=1)
  25. return profile_data, item_data, score_data