AAKTUNotes

Movie Recommendation System with MySQL

Five recommender algorithms measured honestly - including the one where the best RMSE gives the worst recommendations.

PythonFlaskMySQLadvanced5015 lines
999

One-time purchase — source code, database, the written report and everything below, all in a single ZIP.

60-page report (Word)PPTSynopsis13 diagrams

No account needed — pay & download instantly

Look inside the report

+48
more pages in the ZIP

Showing the first 12 pages of 60. Tap any page to read it full size — this is the actual Word file you get, not a mock-up.

Screenshots

Tap any screenshot to open it full size. These are from the project actually running — not mockups.

About this project

A movie recommender built on the MovieLens 100k dataset - 100,000 real ratings, 943 users, 1,682 films - with five algorithms written from first principles in NumPy: item-item collaborative filtering, user-user collaborative filtering, matrix factorisation by SVD, a content-based model over genres, and a popularity baseline. There is no recommender library anywhere in it, so every step can be read and measured.

What lifts this above the usual recommender project is the evaluation. Most of them report an RMSE, announce that it is low, and stop. This one measures seven things - RMSE, MAE, Precision@10, Recall@10, NDCG@10, catalogue coverage and novelty - and the interesting part is that they disagree with each other. Measured on a time-based split: the model with the best RMSE has the worst recommendations of all seven, scoring 0.0006 on Precision@10 against 0.0942 for the same model with one line changed. RMSE cannot see the difference between them, because it scores rating predictions and recommendation is a question about ordering.

That one line is the shrinkage term. Item-item CF scores a film as a weighted average of your ratings on similar films, and a film that exactly one person rated five stars therefore scores a perfect 5.0 and lands on top of everybody's list. Adding a constant to the denominator holds those down until there is enough evidence. Measured, that takes Precision@10 from 0.0007 to 0.0962 - a factor of 137 - while RMSE stays at 1.042 in both cases. The site lets you switch the correction off from a dropdown and watch the recommendations turn into obscure films nobody has heard of.

The project also measures what accuracy hides. The popularity baseline, which does no personalisation whatsoever, beats two of the personalised models outright. The most accurate models show about a quarter of the catalogue while popularity shows 3.5% - and across the seven models the correlation between accuracy and coverage is negative, about -0.54, so a system chosen on accuracy alone quietly stops showing most of its catalogue. Cold start is measured rather than asserted: with five ratings per user the popularity baseline scores 0.0413 and item-CF only 0.0235, and the crossover comes somewhere around forty ratings. That is why the site asks a new member to rate ten films and tells them, in plain words, that until then it is showing a popularity list.

MySQL is used properly throughout. Every table is InnoDB with real foreign keys, a UNIQUE key makes a duplicate rating impossible even from two tabs at once, the 100,000-row import is batched rather than row-by-row, and the model cache is invalidated the moment a rating changes so a member sees the effect of their own rating immediately.

Features

  • Five recommender algorithms written from scratch in NumPy - no recommender library
  • Switch algorithm from a dropdown and watch the same user's list change
  • One option deliberately removes the shrinkage correction so you can see a broken recommender
  • Seven metrics measured: RMSE, MAE, Precision@10, Recall@10, NDCG@10, coverage, novelty
  • The model with the best RMSE is not the model with the best recommendations - and the project proves it
  • Catalogue coverage measured live: popularity shows 3.5% of the catalogue, item-CF shows 26%
  • Cold start measured, not assumed - popularity beats personalisation below about ten ratings
  • The site tells a new member honestly that it is showing a popularity list, and why
  • Explanations come from the model's own arithmetic - the largest terms in the score, not a story written afterwards
  • Time-based train/test split, because a random split lets a model see the future
  • Run the whole evaluation from the admin panel and watch the numbers appear
  • Every reported figure is regenerated by one command - nothing is typed into the report
  • MovieLens 100k ships inside the project - 100,000 ratings, no download needed
  • Similar-films lookup by item-item cosine similarity over centred ratings
  • Content-based model over 19 genres, which can recommend a film nobody has rated
  • Hybrid model with configurable weights, because the accuracy/coverage trade-off is a choice
  • Browse, search and filter 1,682 films by genre, year and rating
  • REST API with X-API-Key for recommendations, similar films and rating submission
  • MySQL with InnoDB, real foreign keys and ON DELETE CASCADE throughout
  • UNIQUE (user, film) makes a duplicate rating impossible even from two tabs
  • The model cache clears the moment you rate something, so your rating counts immediately
  • Database, tables and the dataset import all happen automatically - no .sql file to import
  • PBKDF2-SHA256 password hashing with a per-user salt
  • Every query parameterised; a SQL injection attempt is part of the test suite
  • 44 automated self-tests you can run in front of the examiner
  • No CDN anywhere - the whole UI works with the internet switched off

Modules

Rating matrix and cosine similarityItem-item collaborative filtering with shrinkageUser-user collaborative filteringMatrix factorisation (SVD)Content-based model over genresHybrid blending with weightsPopularity baselineEvaluation harness - seven metricsTime-based train/test splitCatalogue coverage and novelty measurementCold-start simulation studyShrinkage studyOnboarding flow for new membersCatalogue browse, search and filtersRating and rating historyRecommendation explanationsSimilar filmsPer-user algorithm switchingAdmin evaluation runner and leaderboardAnalytics dashboardUser and API key administrationREST API with key authentication

Tools

  • Python 3.8+
  • Flask (web framework)
  • MySQL / MariaDB (XAMPP works out of the box)
  • PyMySQL (database driver)
  • NumPy (the matrix maths)
  • MovieLens 100k (ships inside the project)
  • VS Code (or any editor)
  • Any web browser

Requirements

Python 3.8 or newer, and MySQL. XAMPP is the easiest way to get MySQL - install it, open the Control Panel and press Start next to MySQL. Then one command installs the libraries: pip install -r requirements.txt (Flask, PyMySQL and NumPy, about 30 MB). The MovieLens dataset ships inside the project, so there is nothing to download. The database, all its tables and the 100,000-row import happen automatically on first run - there is no .sql file to import. Works on Windows, Linux and Mac.

How to run

1. Extract the ZIP.
2. Start MySQL - open the XAMPP Control Panel and press Start next to MySQL.
3. Open CMD and go to the folder:  cd path\to\movie-recommendation-system
4. Install the libraries:  pip install -r requirements.txt
5. Check everything is ready:  python check_setup.py
6. Load the demo data:  python demo.py
7. Start the app:  python app.py
8. Open http://127.0.0.1:5000 in your browser.
9. Login:  scifi / scifi123  (a sci-fi fan)  |  drama / drama123  (a drama fan)  |  admin / admin123

The first run takes about four seconds because it imports 100,000 ratings.

If MySQL uses a password on your machine, set it once before step 5:
    set MRS_DB_PASSWORD=yourpassword

Before a viva, also run 'python selftest.py' - 44 checks pass in front of the examiner. To regenerate the research numbers used in the report, run 'python -m evaluation.study'.

The same steps are in README.md inside the ZIP, along with a troubleshooting table.

What you get in the ZIP

  • 📁 Full source code — commented throughout, so you can explain it in the viva
  • 🗄️ Database — the schema builds itself on first run, with sample data
  • 📖 README.md — step-by-step run instructions, database design and troubleshooting
  • 📄 Full project report (Word)Written out and formatted for AKTU — not an outline you have to fill in
  • 📊 Presentation (PPT)Ready for the final viva presentation
  • 📝 Synopsis (Word)The short write-up your guide asks for before approval
  • Viva questions with answersThe questions examiners actually ask about this project
  • 📐 13 ready-made diagrams — DFD, ER, use case, sequence and architecture, as images you can paste straight into the report
Share on WhatsApp

Other projects