Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- movieId userId rating
- 1 1 1.0
- 1 2 4.5
- 1 5 5.0
- 1 8 5.0
- 1 10 5.0
- 2 1 2.0
- 2 3 4.5
- 2 5 5.0
- 2 6 3.0
- 2 8 4.0
- {
- 0:[1.0, 4.5, 0.0, 0.0, 5.0, 0.0, 0.0, 5.0, 0.0, 5.0]
- 1:[2.0, 0.0, 4.5, 0.0, 5.0, 3.0, 0.0, 4.0, 0.0, 0.0]
- }
- def build_rating_vector_for_movie(movie_id, num_users):
- rating_vector = [0] * num_users
- movie_group = user_rating_by_movie.get_group(movie_id)
- for u, r in zip(movie_group.userId.values, movie_group.rating.values):
- rating_vector[u - 1] = r
- movie_user_ratings[movie_id] = rating_vector
Add Comment
Please, Sign In to add comment