KNN Recommender
By using MovieLens Datasets we build a recommender system based on KNN Item-Based Collaborative Filtering.
Enviroment Setup
Use poetry to set up the Python environment (Python >= 3.9)
Get the full data set from MovieLens Datasets and put the movies.csv and ratings.csv in this repo.
Complete the exercises
Find all the TODO comments in knn_recommender.py and finish the missing pieces in the code. The finished version is in the finished branch
Run in CLI
Run the knn_recommender.py with the following optional options:
--movie_name: provide your favoriate movie name--top_n: top n movie recommendations--path: input data path, default to be./--movies_filename: default to bemovies.csv--ratings_filename: default to beratings.csv
Example:
python knn_recommender.py --movie_name "Iron Man" --top_n 10
Run in Browser
Make sure you have run it once in the CLI and have the pickle files (hashmap.p and movie_user_mat_sparse.p) in this repo
Start a local webserver:
python -m http.server
Open http://0.0.0.0:8000 and select knn_recommender.html from there
Presentation slides
Visit the slides on slides.com
Credit to Kevin Laio (KevinLiao159) for original code and blog post