Skip to content

A webapp for recommending movies based on two models: collaborative filtering with non-negative matrix factorisation and k-nearest neighbours algorithm.

License

Notifications You must be signed in to change notification settings

fra-mari/Two_Movie_Recommenders

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Statistically Significant Movie Recommender(s)

A webapp for movie recommendations made via two different models (NMF and KNN)

MIT license Maintenance

This webapp provides a simple interface for two movie recommender systems:

  1. Based on the user's ratings on five different movies, the first recommender uses Collaborative Filtering with Non-Negative Matrix Factorization (NMF) to suggest another five titles.
  2. The second recommender just asks for the title of the user's favourite movie, and uses Item-Based Collaborative Filtering with K-Nearest Neighbours (KNN) and Cosine Similarity to produce a list of ten similar movies.

Also features a function to automatically update and refine the NMF model every 12 hours on the basis of the ratings input by the webapp's users.

gif

Data Set

This project is based on the MovieLens 100k Dataset. Click here for more information.

Tech Stack


How To Use This Code

➡️   On UNIX Systems

If you use MacOs or Linux, clone this repository and cd into the folder recommender_app. Then follow these simple steps:

  1. Install the required Python libraries with pip install -r requirements.txt.

  2. Generate the NMF trained models by running python movie_recommender.py. The process may take a few minutes, but the module also takes care of starting the webapp once the training phase achieved:

    • When your Terminal prints Now starting the Flask app, open the address http:https://localhost:5000 in your browser for using the webapp, then follow the instructions on the CLI to decide whether to enable the automatic retraining of the models based on the ratings provided by the app's users or not.

    ⚠️⚠️ On some Linux versions, you may need to apt install lsof before running the movie_recommender module.

  3. Once the NMF-model files generated, you can always access the webapp by running python movies_app.py.

P.S.: If you prefer to use Docker, just follow the instructions in the following paragraph.

➡️   On Windows

You may recur to WSL, but the simplest way is probably to use Docker. All you have to do is:

  • cd into the folder recommender_app.

  • Build the image from the provided Dockerfile by running docker build . -t movies.

  • Create and start a container by running docker run -ti -p 5000:5000 --name recommender movies. You will get access to the container's Bash Command Line.

  • Run python movie_recommender.py. Refer to point 2 of the previous paragraph for the next steps and options. The webapp will be available at http:https://localhost:5000.

  • To quit the container's environment and CLI, you may use the command exit.


Credits

The code in this repository is an extended and reworked version of the original project developed in collaboration with Behzad Azarhoushang and Laura Bartolini.


To Do

  • Improve the CSS of the website.
  • Show the movie posters of the recommended movies.
  • Tests.

About

A webapp for recommending movies based on two models: collaborative filtering with non-negative matrix factorisation and k-nearest neighbours algorithm.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages