How sinnytk/recommander works
Project type and purpose
• ReCommander is a full-stack web application built with Django that delivers content-based movie recommendations using a Random Forest model (scikit-learn).
• Its primary function is to serve a survey UI (asking users for favorite and watched movies) and compute recommendations from a pre-trained RF model querying a Postgres database populated from the MovieLens dataset.
File structure
• Top-level:
• Pipfile & Pipfile.lock → Python dependencies via pipenv
• manage.py → Django command-line entry point
• Two Django apps under recommander/:
– recommander/ (project settings, URL router, WSGI, base templates/static)
– survey/ (survey views, URLconf, models.py, migrations, templates/static for favorite/watched/movies)
• Static & templates directories follow Django’s MVC pattern (Templates in /templates, static assets in /static).
• survey/models.py defines how survey responses and Movie data map to the DB (Postgres).
• No explicit training script here but “proximity matrix logic” and RF model likely run offline or via a Django management command.
README
• Tech stack: Django, scikit-learn (Random Forest), Postgres, MovieLens dataset.
• Workflow hints:
1. Denormalize and select features from raw dataset → populate Postgres
2. Survey web app collects user preferences
3. Proximity matrix / RF logic computes recommendations
4. Serve results via Django views & templates
a. Main components
• User Browser (Client)
• Django Web Server (WSGI application)
• URL Router → survey.views → business logic
• Templates & Static File Server
• Database (Postgres) storing denormalized MovieLens data & survey responses
• ML Component
• Offline Trainer (Python/Scikit-Learn script or management command)
• Prediction Engine (RF model loaded in memory for inference)
• External Dataset Source (MovieLens CSVs, IMDbPY API)
b. Relationships & interactions
• User submits survey → HTTP POST → Django view
• View retrieves user input & DB data → calls Prediction Engine → fetches top-N recommendations → writes/reads survey instance in DB → renders HTML
• Offline Trainer periodically reads raw CSVs, performs feature selection, trains RF model → persists serialized model (e.g., pickle) to a model store or file system
• At startup or on demand, Prediction Engine loads the serialized model
c. Architectural patterns/design principles
• MVC (Django): Models ←→ Views ←→ Templates
• Separation of concerns:
• Presentation layer (HTML/CSS/JS in templates/static)
• Business logic layer (views and RF inference)
• Data layer (Django ORM & Postgres)
• Offline vs. online processing: training (batch) vs. inference (real-time)
d. Key technologies
• Django (URL routing, ORM, templating)
• Postgres (persistent storage)
• Scikit-Learn Random Forest (ML algorithm)
• pipenv (environment & dependency management)
• MovieLens dataset (CSV source)
• IMDbPY (optional enrichment via API)
Detailed Checklist
• Offline vs. online distinction is visually clear