
Recommended Experience
Python 3.6+ (such as the 30 Days of Python course)
Django 3.2+ (such as the courses Your First Django Web Project or Try Django 3.2)
Celery with Django (such as Time & Tasks 2 course or the linked blog post in resources)
Orchestrate machine learning pipelines with Django, collecting user data, preparing it with pandas, and training models via Celery with PyTorch, addressing cold start with fake data.
Learn to build a Django management command within a profiles app to generate fake user data, using bulk create and a count argument to control output.
Load the movies dataset into the Django movie model by parsing a CSV with dict reader, validating release dates, and bulk creating records.
Build a flexible Django ratings model using a generic foreign key and content types to rate multiple models, with reverse relations and admin-ready calculations of counts and averages.
Enrich a view with the authenticated user's ratings by filtering the rating queryset and using a template tag with a dict to map object IDs to ratings.
Learn to add dynamic content in Django with tmcs and Django HTML, enabling rating saves and list reordering without page reloads. Implement template switching and sorting (recent, unpopular) via get_queryset.
Develop an infinite rating flow in Django with HTMX by rendering a random movie, enabling skip and rate actions, and refreshing content via x-trigger headers and template swapping.
Load real ratings into the Django database from a csv in a jupyter notebook, creating any missing users and transforming the data into rating records via pandas and bulk create.
Identify and resolve inconsistencies between movie and rating data by locating missing movie IDs, enriching IMDB identifiers with pandas, and updating Django movie records and ratings accordingly.
Learn to build a Django recommendation engine by computing a popularity score from rating average and count, sorting by score to show popular and unpopular movies.
Learn collaborative filtering for a django-based recommendation engine by using user ratings and latent features to predict scores and tailor suggestions, addressing cold-start.
Explore collaborative filtering with surprise ml by loading and cleaning data, setting a rating scale, cross-validating with rmse and mae, training the model, and exporting it with pickle for inference.
Store machine learning predictions in a Django suggestion model modeled after ratings, including did_rate and did_rate_timestamp, then bulk create, migrate, and verify did_rate updates after ratings.
Explore how to implement position ranking for movie querysets in Django using window functions, dense_rank, and annotate to create a continuous position field for machine learning predictions.
Build a recommendation engine using Django & a Machine Learning technique called Collaborative Filtering.
Users will rate movies and the system will automatically recommend new ones. These recommendations will be done in batches (ie not in real time) to unlock a more scalable system for training and helping thousands and thousands of users.
For this course, we'll use a real dataset called MovieLens; this dataset is downloaded in CSV and is used on all kinds of machine learning tutorials. What's special about this course is you'll load this dataset into a SQL database through a Django model. This alone might be worth watching the course as SQL databases are far more powerful than CSV files.
To do the batch inference we implement the incredibly powerful background worker process called Celery. If you haven't used Celery before, this will be an eye opening experience and when you couple it with Django you have a truly powerful worker process that can run tasks in the background, run tasks on a schedule, or a combination of both. Tasks in Celery are simply Python functions with a special decorator.
For rating movies, we'll be using HTMX. HTMX is a way to dynamically update content *without* reloading the page at all. I am sure you know the experience whenever you click "like" or "subscribe" , that's what HTMX gives us without the overhead of using 1 line of JavaScript. This course shows us a practical implementation of using HTMX not just for rating movies, but also sorting them, loading them, and doing much more.
The recommendation engine in Django is really a collection of 3 parts:
Web Process: Setup up Django to collect user's interest and provide recommendations once available.
Machine Learning Pipeline: Extract data from Django, transform it, and train a Collaborative Filtering model.
Worker Process: This is the glue. We'll use Celery to schedule/run the trained model predictions and update data for Django-related user recommendations.
Recommended Experience
Python 3.6+ (such as 30 Days of Python)
Django 3.2+ (such as Your First Django Web Project or Try Django 3.2)
Celery with Django (such as Time & Tasks 2 or this blog post)