https://github.com/nomomon/anime-recsys
:film_strip: Development and comparison of user-item recommendation systems in TensorFlow on an anime dataset.
https://github.com/nomomon/anime-recsys
anime collaborative-filtering content-based-recommendation deep-learning keras machine-learning matrix-factorization neural-network recommendation-system recommender-system recsys tensorflow tf-recsys
Last synced: 2 months ago
JSON representation
:film_strip: Development and comparison of user-item recommendation systems in TensorFlow on an anime dataset.
- Host: GitHub
- URL: https://github.com/nomomon/anime-recsys
- Owner: nomomon
- License: mit
- Created: 2021-09-01T12:04:02.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-09-06T10:23:10.000Z (almost 5 years ago)
- Last Synced: 2025-01-15T13:44:32.061Z (over 1 year ago)
- Topics: anime, collaborative-filtering, content-based-recommendation, deep-learning, keras, machine-learning, matrix-factorization, neural-network, recommendation-system, recommender-system, recsys, tensorflow, tf-recsys
- Language: Jupyter Notebook
- Homepage: https://nomomon.github.io/Anime-RecSys
- Size: 413 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Anime RecSys

[](https://drive.google.com/drive/folders/1lUwT4v3Uji4JCMmjU4_qEpBQ2yl8HrYc)
[](/LICENSE)
Development and comparison of user-item recommendation systems in TensorFlow on an anime dataset.
## What's this about
Building recommendation systems using collaborative filtering on the [Anime Recommendation Database 2020](https://www.kaggle.com/hernan4444/anime-recommendation-database-2020) from Kaggle. All models can be downloaded from the Drive.
There are two common ways of recommending:
- **Collaborative filtering** — predictions based on collected preferences from many users.
- **Content-based filtering** — predictions based on item descriptions and user profiles.
Right now we focus only on collaborative filtering.
### Results
**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.
## How to launch
Open notebooks in Jupyter or Google Colab:
```bash
jupyter notebook User_Anime_Rating_Predictions.ipynb
```
Pre-trained models available on [Google Drive](https://drive.google.com/drive/folders/1lUwT4v3Uji4JCMmjU4_qEpBQ2yl8HrYc).
## Predicting User-Anime Ratings
[](/User_Anime_Rating_Predictions.ipynb)
[](https://colab.research.google.com/github/nomomon/anime-recommendations/blob/master/User_Anime_Rating_Predictions.ipynb)
One way to recommend items is by predicting _what rating a user will give_, then showing the highest-rated unseen items.
### Matrix Factorization
Decompose the user-item interaction matrix into two lower-dimensional matrices. We never actually create the full rating matrix — instead we use embeddings.
### Neural Network
Concatenate user and item embeddings, pass through dense layers. Last layer outputs the predicted rating.
## Predicting User-Anime Interactions
[](/User_Anime_Interactions_Predictions.ipynb)
[](https://colab.research.google.com/github/nomomon/anime-recommendations/blob/master/User_Anime_Interactions_Predictions.ipynb)
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.
## Hybrid (Multi-task)
[](/User_Anime_Hybrid_Predictions.ipynb)
[](https://colab.research.google.com/github/nomomon/anime-recommendations/blob/master/User_Anime_Hybrid_Predictions.ipynb)
A model that handles both tasks — predicting ratings and interactions — using shared embeddings. The loss is a weighted sum of both task losses.