Machine Learning

Supervised Learning: Classification / Recommendation Systems


7. Recommendation Systems

A Recommendation System predicts the preference or rating a user would give to an item. They are widely used in e-commerce (Amazon) and streaming (Netflix, Spotify).

1. Content-Based Filtering

Recommends items similar to those a user has liked in the past, based on item attributes (features).

Core Idea: "If you liked item A, and item B is similar to A, you will like item B."

How it works:
  1. Build an item profile (e.g., genre, director for movies).
  2. Build a user profile based on items they interacted with.
  3. Compute similarity using Cosine Similarity.
cos(θ) = (A · B) / (||A|| × ||B||)

2. Collaborative Filtering

Recommends items based on the preferences and behaviors of similar users, without using item features.

Core Idea: "Users who liked the same items as you in the past will likely have similar tastes for new items."

User-Based CF Algorithm
  1. Find users similar to the active user using Pearson correlation or Cosine similarity on their rating vectors.
  2. Identify items liked by these similar users but not yet seen by the active user.
  3. Predict the rating for these unseen items by taking a weighted average of the similar users' ratings.
  4. Recommend the items with the highest predicted ratings.
Model-Based CF (Matrix Factorization)

Represents the user-item rating matrix as a product of two lower-dimensional matrices. R ≈ U × Vᵀ.

3. Hybrid Filtering

Combines both approaches to overcome individual limitations (like the cold-start problem). Examples include Netflix, which uses matrix factorization (collaborative) along with genre/cast features (content).