- Introduced by
- GroupLens; Sarwar et al. (item-based); Koren et al. (matrix factorization)
- Year
- 2001
- Type
- Recommendation from user-item interactions
- Family
- Recommender systems
What does it do?
Collaborative filtering recommends items to a user from the interaction patterns of many users, without needing item content.
Neighbourhood methods that predict from similar users or items were formalized for item-based recommendation by Sarwar et al. (2001). Matrix factorization, which learns latent user and item factors, is described by Koren, Bell, and Volinsky (2009), who discuss it in the context of the Netflix Prize competition.
The intuition behind the method
The method needs no description of what an item is, only a record of how people have interacted with it. It works on a very large table of users against items that is mostly empty. If two users have rated many of the same items alike, an item one of them rated highly and the other has not seen is a candidate recommendation (user-based). If two items are rated similarly by the same people, liking one suggests liking the other (item-based). Matrix factorization instead assigns each user and each item a short vector of hidden factors, predicts a rating as the dot product of the two vectors, and fits the vectors so that they reproduce the observed ratings.
History
Collaborative filtering is usually traced to the GroupLens project and Tapestry in the 1990s, although the sources used for this entry do not cover that period. Sarwar, Karypis, Konstan, and Riedl (2001) analysed item-based collaborative filtering algorithms and compared them with the basic k-nearest-neighbour approach. Koren, Bell, and Volinsky (2009) reviewed matrix factorization techniques for recommender systems, citing the Netflix Prize competition.
When to use it
Choose collaborative filtering when you have a large log of user-item interactions and want recommendations driven by behaviour rather than item attributes, as in e-commerce, streaming, or news. Choose item-based neighbourhood methods when recommendations must be explainable, since each prediction is a weighted sum over named similar items, and when many recommendations per second are needed, since Sarwar et al. (2001) proposed them for scalability: item-item relationships can be computed from the matrix before recommendations are generated. Similarity computation can still become costly, and unreliable on very thin data. Choose matrix factorization when the matrix is large and sparse and predictive accuracy matters more than explainability. Do not rely on pure collaborative filtering when most users or items are new, because they have no interactions to learn from; in that case a content-based or hybrid model is needed. It is also a poor fit when interaction data is too thin for the similarities or factors to be estimated reliably.
Limitations and considerations
- A new user has no row and a new item has no column, so the neighbourhood formula has no similarities to draw on and the factorization model has no fitted vector for them.
- Similarity is computed from ratings the two users or items share, so pairs with little overlap produce unreliable similarity values.
- The factors learned by matrix factorization are hidden dimensions without labels, so the model is harder to explain than a neighbourhood prediction.
- Popular items accumulate many interactions and dominate the observed matrix; the formulas given contain no correction for this, so recommendations can drift toward them.
- Observed interactions are not a random sample of preferences: users tend to interact with items they already expect to like, and exposure may have been shaped by an earlier recommender. Unobserved entries mix 'not seen' with 'disliked', so the model should not be assumed to recover true preferences, and high offline scores should be read with this in mind.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Needs only the user-item interaction matrix; the neighbourhood and factorization models shown here use no item content or attribute features.
- Each neighbourhood prediction is a similarity-weighted average over specific items, so the items that drove a score can be shown to the user.
- The factorization objective sums only over the observed ratings, so the sparse matrix does not have to be filled in before the model is fitted.
- The factorization approach can be extended to implicit feedback, temporal effects, and confidence levels, as Koren et al. (2009) note.
Applications
- Product recommendations in e-commerce.
- Movie, music, and video recommendations on streaming platforms.
- News and content personalization.
- Friend / connection suggestions in social networks.
- Cross-sell and 'customers also bought' features.
How it works
How it works
The input is a matrix R with one row per user and one column per item, holding ratings or implicit interactions such as clicks or purchases. Most entries are unobserved, and the task is to estimate the missing entries so that the highest-scoring unseen items can be recommended.
Formula
R \in \mathbb{R}^{u\times i}\ \text{(ratings/interactions, mostly missing)}Neighbourhood methods measure how alike two users or two items are from the ratings they share. The formula shown is cosine similarity on raw rating values, with the sums taken over the items k rated by both a and b, so two vectors score highly when they point in the same direction. It is not Pearson correlation, which first subtracts each vector's mean rating and sums (r_ak − mean_a)(r_bk − mean_b) over co-rated items. Sarwar et al. (2001) compare item-item correlation with cosine similarity between item vectors.
Formula
\text{sim}(a,b) = \dfrac{\sum_k r_{ak} r_{bk}}{\sqrt{\sum r_{ak}^2}\sqrt{\sum r_{bk}^2}}\ (\text{cosine / Pearson})The predicted rating for user u on item i is a weighted average of u's own ratings on the items j in the neighbourhood N(i), with the similarities as weights, divided by the sum of the absolute similarities. N(i) is the set of the k items most similar to i that user u has rated; the choice of k and whether negative similarities are kept in N(i) are design decisions to tune. Sarwar et al. (2001) study this item-based form and report that item-based algorithms perform substantially better than user-based algorithms in their experiments.
Formula
\hat r_{ui} = \dfrac{\sum_{j\in N(i)} \text{sim}(i,j)\, r_{uj}}{\sum_{j\in N(i)} |\text{sim}(i,j)|}Each rating is approximated by the dot product of a user vector p_u and an item vector q_i. The vectors are fitted by minimizing squared error over the observed ratings plus a penalty λ on the squared norms of the vectors, which discourages fitting the observed entries too closely. Koren et al. (2009) report that such models are superior to classic nearest-neighbour techniques for product recommendation.
Formula
\hat r_{ui} = p_u^\top q_i,\quad \min_{P,Q}\sum_{(u,i)\in\mathcal{K}} (r_{ui}-p_u^\top q_i)^2 + \lambda(\lVert p_u\rVert^2+\lVert q_i\rVert^2)Common pitfalls
- Applying the similarity formula to raw ratings: as written it does not remove each user's or item's average rating, so users who rate uniformly high or low affect similarity values. Mean-centred (Pearson-style) or adjusted similarities address this.
- Filling missing entries with zero before computing similarity: zero values change the norms in the denominator, so unobserved entries should be excluded rather than set to zero.
- Judging the model only by rating error: the factorization objective minimizes squared error on known ratings, which does not measure the quality of the ranked top-N list that users actually see. For top-N lists, rank all unseen items for each user and evaluate on held-out interactions with ranking metrics such as precision@N, recall@N, or NDCG; RMSE alone is insufficient.
- Tuning the penalty λ on the training data, which tends to favour weaker regularization; it should be selected on held-out data.
- Splitting interactions at random rather than by time, which lets future interactions leak into training.
Frequently asked questions
What is the difference between user-based and item-based collaborative filtering?
User-based collaborative filtering recommends items liked by users similar to you. Item-based collaborative filtering recommends items that are similar, in how users rated them, to items you have already rated highly. Sarwar et al. (2001) report that item-based algorithms performed substantially better than user-based ones in their experiments, and item-item relationships can be computed from the matrix before recommendations are generated.
How does matrix factorization differ from neighbourhood methods?
Matrix factorization represents each user and item by a short vector of hidden factors learned from the observed ratings, and predicts a rating as the dot product of the two vectors. Neighbourhood methods instead average the ratings of similar users or items directly. Koren et al. (2009) report that matrix factorization models are superior to classic nearest-neighbour techniques for product recommendation, and that they allow additional information such as implicit feedback, temporal effects, and confidence levels to be incorporated.
What is the cold-start problem?
Collaborative filtering relies on past interactions, so it cannot make good recommendations for brand-new users or items that have none. Common remedies include asking new users for initial preferences, falling back to popular items, or combining the method with content-based features that do not depend on interaction history.
Related methods
Sources
Sarwar, B., Karypis, G., Konstan, J., & Riedl, J. (2001). Item-based collaborative filtering recommendation algorithms. Proceedings of the 10th International Conference on World Wide Web, 285–295.
Open DOI referenceKoren, Y., Bell, R., & Volinsky, C. (2009). Matrix factorization techniques for recommender systems. Computer, 42(8), 30–37.
Open DOI reference