16 · Hybrid & context-aware recommenders
No single signal wins everywhere. Hybrids blend content-based and collaborative scores so a brand-new item — invisible to pure CF — still gets recommended on its features. Context (time, place, device) sharpens the result.
Content-based methods know item features but ignore the crowd; collaborative filtering learns the crowd but is blind to new items. A hybrid combines their scores — weighted, switching, or feature-combination — so each covers the other's blind spot, and a brand-new item that pure CF scores at zero still surfaces on its content signal.
Without this:
Ship pure collaborative filtering and every new item is dead on arrival — it has no interactions, scores zero everywhere, and never gets the impressions it needs to ever earn any. The catalog ossifies around old, popular items.
By now you have two complementary engines. Content-based scoring (Chapter 2) compares an item's features — genre, tags, text embeddings — to a user's taste profile; it works from day one for any item that has features, even one nobody has touched. Collaborative filtering (Chapters 3–4) learns from the crowd's interactions; it captures subtle taste patterns no feature list encodes — but it is silent on cold items.
A hybrid recommender combines them so each covers the other's weakness. Three classic strategies:
- Weighted: compute both scores, normalize, and blend
score = α·CF + (1-α)·content. Simple and strong. - Switching: pick a method per situation — use CF when the item has enough interactions, fall back to content for cold items.
- Feature combination / augmentation: feed content features into the collaborative model (what LightFM does) so one model uses both.
The headline win is cold-start. Pure CF scores a brand-new item 0 for everyone (no interactions → no latent signal). But that item still has features, so its content score is nonzero — and a weighted hybrid carries it into the recommendations on the content signal alone, exactly when CF is useless. The cell below demonstrates this directly: a fresh item that CF ranks last is rescued by the hybrid.
Python (in browser)
Weighted hybrid = α·CF + (1-α)·content. A brand-new item that pure CF buries dead last (24/24) is lifted far up the ranking by its content features alone — the cold-start rescue.
Python runs entirely in your browser via Pyodide (~6 MB on first Run, cached after).
Beyond blending, real systems are context-aware: the same user wants different things at different times. A recommender can condition on context — time of day, day of week, location, device, current session — so morning vs. night, weekday vs. weekend, or phone vs. TV each get a tuned ranking. The simplest version multiplies a base score by a learned context bias; richer ones (Factorization Machines, contextual bandits) treat context as extra features in the model. The cell below shows the simplest contextual reweighting: the same base scores produce different top picks once we apply a time-of-day boost.
Python (in browser)
Context-aware reweighting: one user's base scores times a time-of-day context bias yield different morning vs. evening top picks.
Python runs entirely in your browser via Pyodide (~6 MB on first Run, cached after).
A brand-new item with zero interactions gets a collaborative-filtering score of 0 for every user. How does a weighted hybrid still recommend it?
- Hybrids combine content-based and collaborative scores — weighted, switching, or feature-combination — so each covers the other's blind spot.
- The headline win is cold-start: an item CF scores 0 still surfaces via its content features in a weighted blend.
- Context-aware recsys conditions the ranking on time/location/device, so one user's feed differs across situations.
Netflix and Spotify run hybrid ensembles; YouTube and news apps are heavily context-aware (time, session, device drive the home feed).
If you remove it: Pure CF leaves every new item invisible and ignores that the same user wants different things at 8am and 11pm — both crush real-world engagement.