Learn practical skills, build real-world projects, and advance your career
Updated 4 years ago
Predicting Anime Ratings using Matrix Factorization in PyTorch
#library imports
import numpy as np
import pandas as pd
from collections import Counter
from sklearn.model_selection import train_test_split
from scipy import sparse
import jovian
Problem Statement :
Given a set of user ratings for anime, predict the rating for each user-anime pair
Dataset
Anime Recommendations Database from Kaggle:
https://www.kaggle.com/CooperUnion/anime-recommendations-database
We have a total of 69600 users and 9927 anime. There are 6337241 ratings provided (out of 690,919,200 possible ratings).
anime_ratings_df = pd.read_csv("rating.csv")
anime_ratings_df.shape
print(anime_ratings_df.head())
user_id anime_id rating
0 1 20 -1
1 1 24 -1
2 1 79 -1
3 1 226 -1
4 1 241 -1
Rating of "-1" indicates a missing ratings, we can get rid of these rows