Content-Based Filtering
Recommending items based on attribute similarity and historical user feature profiles.
How Content-Based Filtering Works
1. ITEM FEATURE VECTORS 2. USER PROFILE VECTOR u
Item A (Action Movie): [1.0, 0.1, 0.9] User likes Item A & C:
Item B (Romance): [0.0, 0.9, 0.1] Profile Vector u = Average(A, C) = [0.95, 0.1, 0.85]
Item C (Sci-Fi Action):[0.9, 0.1, 0.8]
│
▼
3. SIMILARITY MATCHING
CosSim(u, Item B) = 0.10 (LOW)
CosSim(u, New Item D [0.9, 0.0, 0.9]) = 0.98 (RECOMMEND!)
- Extract Item Feature Representation: Convert raw metadata (Text descriptions, genres, tags) into vector $\mathbf{v}_i \in \mathbb{R}^d$ using TF-IDF, Word2Vec, or dense Transformer embeddings.
- Build User Profile Vector: Aggregate vectors of items liked by user $u$:
$$\mathbf{u} = \frac{\sum_{i \in \text{Liked}u} r{ui} \cdot \mathbf{v}i}{\sum{i \in \text{Liked}u} r{ui}}$$
- Predict Preference & Rank: Score candidate items using Cosine Similarity:
$$\text{Score}(u, i) = \cos(\mathbf{u}, \mathbf{v}_i) = \frac{\mathbf{u} \cdot \mathbf{v}_i}{|\mathbf{u}| |\mathbf{v}_i|}$$
Comparative Matrix: Content-Based vs Collaborative Filtering
| Dimension | Content-Based Filtering | Collaborative Filtering |
|---|---|---|
| Data Required | Item metadata attributes & user logs | User-Item interaction matrix $R_{ui}$ |
| New Item Cold-Start | Excellent (Recommends based on metadata) | Poor (Requires user interactions) |
| New User Cold-Start | Poor (Needs initial user interest tags) | Poor (Requires initial user clicks) |
| Cross-Category Diversity | Low (Trapped in user feature bubble) | High (Discovers non-obvious user overlap) |
| Domain Dependence | Requires feature engineering & metadata | Domain-agnostic |
Modern Hybrid Recommendation Architecture
Production systems combine Content-Based and Collaborative Filtering in a Two-Tower Deep Neural Network:
User Context Features ──► [ User Tower Deep Net ] ──► Vector u ──┐
├──► Dot Product (u · v)
Item Metadata Features ──► [ Item Tower Deep Net ] ──► Vector v ──┘
The Item Tower incorporates both content metadata (for cold start) and historical collaborative interactions!
Say this out loud
"Content-Based Filtering recommends items by matching item feature attributes (genres, tags, embeddings) against a user feature profile. It solves the Item Cold-Start problem for new items with zero click history, but suffers from a lack of serendipity by trapping users in feature filter bubbles. Production systems use Two-Tower hybrid models to combine content metadata and collaborative signals."
Follow-ups to expect
- How do you solve New User Cold-Start in Content-Based Filtering? Present an explicit onboarding preference quiz during user sign-up ("Select 3 genres you love"), constructing an initial user profile vector $\mathbf{u}_0$ immediately.
- What is TF-IDF in Content-Based Filtering? Term Frequency-Inverse Document Frequency. Converts unstructured item text descriptions into sparse vectors, emphasizing rare distinctive keywords while discounting common filler words.
Check yourself
Why does Content-Based Filtering solve the Item Cold-Start problem in recommendation systems?