Techniqueintro
Collaborative filtering
Also called CF.
Recommends items from the behavior of many users, assuming users who agreed in the past will agree again, with no item content.
Collaborative filtering predicts what a user will like from the recorded behavior of many users: ratings, purchases, clicks or views. It assumes that users who agreed in the past will agree again, so it needs no description of the items, only the rating matrix. The two main families are neighborhood methods, which compare users or items directly on their common ratings, and latent factor models, which explain all ratings by a small number of hidden factors per user and per item.
In plain words
If you and a friend liked the same ten films, and your friend also liked an eleventh film that you have not seen, there is a good chance that you will like it too. Collaborative filtering does this with thousands of people at once. It looks for people whose past choices match yours, or for items that the same people tend to like together, and it uses these patterns to fill in the films you have not rated.
It never looks at what an item is about. The same method works for films, songs, books or shop products, because it uses only who liked what.
When it applies
- Many users share items. The method needs overlap: users must have rated some of the same items, and items must have some of the same users.
- Taste is shared. It works when preferences fall into patterns that many users follow, such as genres or styles, even if nobody names them.
- Item content is poor or hard to use. Films, music or jokes are hard to describe by features that predict taste; the ratings carry that signal.
- Not for brand new users or items. A user or item with no interactions has nothing to compare, see the cold-start problem. Then content-based filtering or a hybrid is needed.
The template
- Collect the interactions into a sparse rating matrix with known pairs . Decide whether the values are explicit ratings or implicit events.
- Normalize. Remove the effects that are not about taste: the global mean , the bias of each user, who may rate everything high, and the bias of each item. Many methods work on or on .
- Choose how agreement is modeled.
- Neighborhood (memory-based). Measure the similarity of two users on their co-rated items, or of two items on their common users, for example by Pearson correlation or adjusted cosine similarity, and predict from the most similar neighbors, as in -nearest neighbors.
- Latent factors (model-based). Give each user and item a vector of numbers and fit them so that , plus biases, matches the known ratings, as in matrix factorization.
- Fit on the known pairs only. A blank is unknown, not zero.
- Predict and rank. Score the open items of each user, add back the normalization of step 2, and keep the best by top- selection.
- Evaluate on held out data, with the measures of the recommendation problem, and tune the neighborhood size, the number of factors and the penalties there.
Classic examples
- Tapestry (1992). Goldberg, Nichols, Oki and Terry coined the term for a mail system in which users annotated messages, and others filtered on these annotations. The collaboration was manual: a user wrote filters that referred to the annotations of other, named users.
- GroupLens (1994). Resnick et al. made the process automatic for Usenet news: user-based collaborative filtering with Pearson weights over co-rated articles.
- Item-to-item filtering. Sarwar et al. (2001) compared items instead of users, and Linden, Smith and York (2003) described the item-to-item method of Amazon.com, see item-based collaborative filtering. Slope One is a simple item-pair method that updates online.
- The Netflix Prize (2006 to 2009). Latent factor models, such as matrix factorization, alternating least squares and SVD++, together with neighborhood models, gave the most accurate predictions on the competition data.
On the toy matrix of this group, user rated high and low, as did, and opposite to and . A user-based method predicts the open rating from the high rating 4 of the agreeing user and from the low ratings 2 and 1 of the disagreeing users, read in reverse; the user-based page works it out to about 3.934.
Variations
- User-based or item-based. Item-based methods precompute a table of similar items, which is often smaller and more stable than a table of similar users when there are many more users than items.
- Explicit or implicit. With implicit feedback the matrix holds events, and the methods change: ALS for implicit feedback, Bayesian personalized ranking and SLIM.
- Probabilistic and neural models. Probabilistic matrix factorization gives the factor model a Gaussian likelihood; neural collaborative filtering replaces the dot product by a learned function.
- Sequential. Session-based recommendation, with models such as GRU4Rec and SASRec, uses the order of the interactions.
- With side information. Factorization machines and hybrid recommenders add item or user features.
Pitfalls
- Sparsity. Two users often share very few items, and a similarity computed on one or two co-rated items is noise. Shrink such similarities, or use a factor model.
- Popularity. Popular items have many ratings and enter most neighborhoods, so the lists can fill with what everybody already knows. Measure coverage and novelty, not only accuracy.
- Missing not at random. Users rate what they chose to consume, so the known ratings are biased toward liked items. A model fit to them can predict too high for the items users avoided.
- Cold start. New users and items get no personal prediction until they have interactions.
- Feedback loops. The system's own recommendations shape the data it learns from next. See position bias and off-policy evaluation.
- Scale. Comparing all pairs of users costs similarities. Precompute item neighbors, sample, or use approximate methods such as locality-sensitive hashing.
Exercises
- On the toy matrix of the rating matrix page, list the co-rated items of each pair of users. Which pair shares the fewest, and why does that make its similarity less reliable? Hint: and share only and .
- Show that if one user adds 1 to all of their ratings, a prediction for that user of the form also rises by 1, and the predictions for other users do not change when the weights are Pearson correlations. Hint: Pearson correlation does not change when one of its two vectors is shifted.
- A shop has 10 million customers and 100,000 products. Compare the number of user pairs and item pairs, and explain which neighborhood method is cheaper to precompute.
- Explain why a model that fits the dense matrix with zeros in the blanks recommends badly, even if it fits that matrix well. Hint: what does it predict for an item a user has never seen?
References
- David Goldberg, David Nichols, Brian M. Oki and Douglas Terry, Using collaborative filtering to weave an information tapestry, Communications of the ACM 35(12), 61-70, 1992, the Tapestry system, in which users annotate documents and filter on the annotations of other users
- Paul Resnick, Neophytos Iacovou, Mitesh Suchak, Peter Bergstrom and John Riedl, GroupLens, an open architecture for collaborative filtering of netnews, Proceedings of the ACM Conference on Computer Supported Cooperative Work (CSCW 1994), 175-186, the automatic prediction of a user's rating from the ratings of users who agreed with that user in the past
- Badrul Sarwar, George Karypis, Joseph Konstan and John Riedl, Item-based collaborative filtering recommendation algorithms, Proceedings of the 10th International World Wide Web Conference (WWW 2001), 285-295, Section 3 (item similarities and the precomputed model of similar items)
- Greg Linden, Brent Smith and Jeremy York, Amazon.com recommendations, item-to-item collaborative filtering, IEEE Internet Computing 7(1), 76-80, 2003, the offline table of similar items built from the items that customers buy together
- Yehuda Koren, Robert Bell and Chris Volinsky, Matrix factorization techniques for recommender systems, IEEE Computer 42(8), 30-37, 2009, section Recommender system strategies (content filtering against collaborative filtering, neighborhood methods and latent factor models, and the cold start problem)
- Charu C. Aggarwal, Recommender Systems, The Textbook, Springer, 2016, Chapter 2 (neighborhood-based collaborative filtering) and Chapter 3 (model-based collaborative filtering)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W3 standard |
|
Tag JD0Z3X Edit this page History Report an error Markdown