
Development and comparison of user-item recommendation systems in TensorFlow on an anime dataset.
Building recommendation systems using collaborative filtering on the Anime Recommendation Database 2020 from Kaggle. All models can be downloaded from the Drive.
There are two common ways of recommending:
Right now we focus only on collaborative filtering.
Rating prediction:
| Model | val_loss | RMSE |
|---|---|---|
| Hybrid NN | 1.9694 | 1.4034 |
| Neural Network | 1.9897 | 1.4105 |
| Matrix Factorization | 2.8429 | 1.6861 |
Interaction prediction:
| Model | val_loss | Acc | Precision | Recall |
|---|---|---|---|---|
| Hybrid NN | 0.3079 | 0.8790 | 0.8931 | 0.9759 |
| Neural Network | 0.2502 | 0.8050 | 0.8907 | 0.8282 |
| Matrix Factorization | 0.4691 | 0.7678 | 0.8969 | 0.7621 |
The hybrid model wins on most metrics — multi-task learning helps.
Open notebooks in Jupyter or Google Colab:
jupyter notebook User_Anime_Rating_Predictions.ipynb
Pre-trained models available on Google Drive.
One way to recommend items is by predicting what rating a user will give, then showing the highest-rated unseen items.
Decompose the user-item interaction matrix into two lower-dimensional matrices. We never actually create the full rating matrix — instead we use embeddings.
Concatenate user and item embeddings, pass through dense layers. Last layer outputs the predicted rating.
Instead of predicting ratings, we can ask: will the user have a positive interaction with this anime?
Positive = completed + rated above 5. Negative = dropped or rated 5 or below. Same model structures, but with sigmoid on the output.
A model that handles both tasks — predicting ratings and interactions — using shared embeddings. The loss is a weighted sum of both task losses.