Scalable Analytics: chapter 5
Introduction to Recommender Systems and the Data Analysis Landscape
Recommender systems are situated within the broader context of information retrieval and data mining. They belong to a diverse set of applications and methodologies used to manage various data types:
High Dimensional Data: Includes techniques such as Locality Sensitive Hashing (LSH), clustering, and dimensionality reduction.
Graph Data: Involves PageRank, SimRank, community detection, and spam detection.
Infinite Data/Streaming: Focuses on filtering data streams, web advertising, and queries on continuous streams.
Machine Learning Integration: Uses Support Vector Machines (SVM), decision trees, Perceptron, and k-nearest neighbors (kNN).
Applications: Recommender systems coexist with association rules, duplicate document detection, and scalable analytics.
The Shift from Scarcity to Abundance
Traditional retail models were constrained by physical scarcity. Shelf space in stores, airtime on TV networks, and screens in movie theaters are finite resources. However, the web has enabled near-zero-cost dissemination of information, leading to a shift from scarcity to abundance.
The Long Tail Phenomenon: Popular items (the "head") are available in both traditional and digital formats. For example, Wal-Mart and Rhapsody may share a selection of approximately songs. However, thousands of other titles (the "tail") are only available digitally via platforms like Rhapsody, which can offer over titles. Popularity typically follows a power-law distribution where common titles have thousands of monthly plays, while niche titles have fewer but collectively represent a significant market share.
Choice and Filtering: As the number of available products increases, consumers require better filters to find relevant items. Recommender systems serve as these filters (e.g., how the book "Into Thin Air" helped turn "Touching the Void" into a bestseller).
Types of Recommendations
Recommendation engines typically fall into three categories:
Editorial and Hand-Curated: Lists created by experts or staff, such as "Essential Items" or specific lists of favorites.
Simple Aggregates: These use basic popularity metrics, such as "Top 10," "Most Popular," or "Recent Uploads."
Tailored to Individual Users: These leverage user-specific data to provide personalized suggestions, as seen on Amazon, Netflix, and Last.fm.
Formal Model of Recommender Systems
The formal mathematical structure of a recommender system involves the following components:
: A set of customers.
: A set of items.
Utility Function (): A function that maps a customer-item pair to a rating.
: A set of ratings, which is a totally ordered set (e.g., integers or a range ).
The Utility Matrix
The utility matrix provides a tabular view of users and their ratings for specific items (e.g., movies like Avatar, LOTR, Matrix, and Pirates).
Key Problems:
Gathering Known Ratings: Collecting data for the matrix.
Extrapolating Unknown Ratings: Predicting values for the empty cells in the matrix, focusing on identifying high unknown ratings to suggest.
Evaluating Extrapolation: Measuring the success or performance of the prediction methods.
Rating Data Collection
Explicit Ratings: Users are asked directly to rate an item (e.g., star ratings).
Implicit Ratings: Ratings are inferred from user actions, such as purchase history, browsing behavior, or search queries.
Core Challenges in Utility Extrapolation
Sparsity: The utility matrix is typically very sparse because most users only rate a tiny fraction of the total items available.
Cold Start: New items lack ratings, and new users have no rating history to base recommendations on.
Content-Based Recommender Systems
Content-based systems recommend items to a user () that are similar to items user has previously rated highly.
Item Profiles: For each item, a profile is created consisting of a set or vector of features. Finding appropriate features is often the most difficult task.
User Profiles: Created based on the items a user has liked. This can be a weighted average of the profiles of rated items. A variation involves weighting features by the difference between the user's rating for an item and the average rating for that item.
Prediction Heuristic: To estimate the utility of item for user , the cosine similarity between the user profile vector () and the item profile vector () is calculated:
Pros and Cons of Content-Based Approaches
Pros: No dependency on data from other users; handles users with unique tastes; able to recommend new or unpopular items; provides transparency/explanation for recommendations.
Cons: Hard to find appropriate features; difficult for new users; overspecialization (never recommends things outside the user's existing profile); ignores quality judgments from other users.
Collaborative Filtering
Collaborative filtering makes recommendations for user by finding a set () of "similar" users and basing suggestions on their ratings.
Similarity Measures for Users
Let be the vector of ratings for user and for user .
Jaccard Similarity: Measures overlap but ignores rating values.
Cosine Similarity: Considers the angle between rating vectors.
Pearson Correlation Coefficient: Evaluates the linear correlation between users, accounting for their average ratings ( and ). Let be the set of items rated by both:
Rating Prediction for User-User CF
Let be the set of users most similar to who have rated item . Predictions for rating can be made via:
Simple average:
Weighted average using similarity :
Item-Item Collaborative Filtering
Instead of looking for similar users, this approach looks for items similar to item based on ratings across all users.
Prediction Heuristic: The rating for user and item is estimated by taking a weighted average of user 's ratings for items that are similar to : where is the set of items similar to that user has rated and is the similarity between items and .
Comparison: In practice, item-item collaborative filtering often performs better than user-user filtering.
Pros and Cons of Collaborative Filtering
Pros: Works for any kind of item (no feature extraction needed).
Cons: Cold start problem (new users/items); sparsity of the matrix; first rater problem; popularity bias (tends to recommend what is already popular).
Evaluation Metrics for Prediction
Systems are evaluated by comparing predicted ratings () against known test ratings ():
Root Mean Square Error (RMSE):
Precision at Top 10: Measures how many of the top 10 recommended items were actually liked.
Rank Correlation: Measures the correctness of the ordering of items.
Coverage: Percentage of items the system is able to provide recommendations for.
Metric Limitations: Error measures can have a narrow focus on accuracy while ignoring diversity, context, and the reality that systems often only need to predict high ratings accurately.
Latent Factor Models
Latent factor models, such as Matrix Factorization or Singular Value Decomposition (SVD), aim to approximate the utility matrix as the product of two thinner matrices, and .
Approximation:
: Item-factor matrix (items are represented by factors like genre, target demographic, or tone).
: User-factor matrix (users are represented by their preference for those factors).
Heuristic Prediction: The predicted rating is the dot product of the item vector and user vector:
Singular Value Decomposition (SVD)
SVD decomposes a matrix into . In recommendation contexts, . SVD provides minimum reconstruction error (): However, SVD is not defined when entries are missing. Specialized methods are used to find and by minimizing the squared error only over known entries.
Optimization and Regularization
To prevent overfitting (where the model performs well on training data but poorly on test data), regularization is added to the objective function.
Objective Function with Regularization: The parameters control the amount of regularization; higher values shrink parameters where data is scarce.
Stochastic Gradient Descent (SGD): An iterative optimization algorithm used to find and .
Update rule for :
represents the error term, and represents the regularization term.
SGD updates parameters for each individual rating, leading to faster convergence compared to Batch Gradient Descent (BGD), which updates after seeing all ratings.
Integrating Biases and Temporal Dynamics
Advanced models improve accuracy by accounting for systematic biases:
Global Mean (): The average rating across all users and items.
User Bias (): Some users are naturally more critical or lenient (e.g., Star Wars fan vs. critical reviewer).
Item Bias (): Some items are inherently better or worse than the average (e.g., Star Wars having a higher average rating).
Combined Model:
Temporal Biases: Users' preferences and item ratings can change over time (e.g., movie age influencing ratings).
The Netflix Prize Case Study
Netflix held a competition from 2006 to 2009 for a improvement over their CineMatch algorithm.
Dataset: million ratings from users on movies.
Performance Comparison (RMSE):
Global Average:
User Average:
Netflix Baseline:
Basic Collaborative Filtering:
Latent Factors + Biases:
Latent Factors + Biases + Time (Temporal Dynamics):
Grand Prize Winning Entry: ( improvement reached by BellKor's Pragmatic Chaos).
The Big Picture: The final solution involved blending approximately predictors and hundreds of different models.