Algorithm Search⌘K

Problemintro

Recommendation problem

Also called item recommendation.

Given past interactions of users with items, predict the items each user is most likely to rate highly or engage with.

The recommendation problem asks, from a record of past interactions between users and items, which items each user will rate highly or choose next. Its input is a partly filled rating matrix, sometimes with features of the items or users, and its output is a predicted rating for each open pair or a ranked list of items for each user. It is a learning problem: the right answer is the future behavior of the users, which is not in the input, so methods are compared by measured error on held out data, not by an exact objective.

In plain words

A shop, a film service or a news site knows what each customer bought, watched, read or rated. It wants to show each customer a few things that the customer has not seen yet and will probably like. That is the whole task.

Two forms are common. In the first, the system guesses the score that a person would give to a film. In the second, it only has to put the best few items at the top of a short list for each person.

Nobody can check the answer in advance, because it depends on what people will do later. So systems are judged by hiding some of the known data, making guesses for it, and counting how close the guesses were.

Definition

Let UU be a set of mm users and II a set of nn items. The input is a set K⊆U×IK \subseteq U \times I of observed pairs with values ruir_{ui}, which are either explicit ratings on a scale, such as 1 to 5 stars, or implicit records such as a purchase, a click, a count of plays or a viewing time. It may also hold side information: features of the items, features of the users, the time of each interaction, or the context.

Let Iu={i:(u,i)∈K}I_u = \{ i : (u, i) \in K \}. The two standard tasks are:

  • Rating prediction. Output a function r^:U×I→R\hat r : U \times I \to \mathbb{R}, to be used on pairs not in KK.
  • Top-NN recommendation. For each user uu, output an ordered list of NN items, usually from I∖IuI \setminus I_u.

A method is judged on data it did not see. The usual protocol splits the known pairs into a training part and a test part, fits on the training part, and measures on the test part:

  • For rating prediction, the root mean squared error 1∣T∣∑(u,i)∈T(rui−r^ui)2\sqrt{\frac{1}{|T|} \sum_{(u, i) \in T} (r_{ui} - \hat r_{ui})^2} over the test pairs TT, or the mean absolute error. Lower is better.
  • For lists, precision at kk, recall, and normalized discounted cumulative gain, with the test items of each user as the relevant set. Higher is better.
  • Beyond accuracy, the coverage of the catalog, the novelty and the diversity of the lists, and, in a running system, measured clicks or sales in a controlled experiment.

Herlocker et al. (2004) survey these measures and argue that the choice of measure must match the task that the users want the system to do. No measure is the definition of the problem; each one is a stand-in for future satisfaction.

Variants

Examples

The toy rating matrix used in this group has four users, four items and 14 known ratings out of 16:

i1i_1 i2i_2 i3i_3 i4i_4
u1u_1 5 4 - 1
u2u_2 4 5 4 2
u3u_3 1 2 2 5
u4u_4 - 1 1 4

Rating prediction asks for r^u1i3\hat r_{u_1 i_3} and r^u4i1\hat r_{u_4 i_1}. Top-1 recommendation for u1u_1 has only one open item, i3i_3, so the interesting question is the predicted value. Different methods give different answers on the same data, all of them correct outputs of their methods: user-based filtering with Pearson weights gives about 3.934, item-based filtering with positive adjusted cosine weights about 4.540, and Slope One 53/18≈2.94453/18 \approx 2.944. The problem itself does not say which is right; only the true later rating of u1u_1 would.

At large scale, the Netflix Prize data held more than 100 million ratings of about 500,000 customers for more than 17,000 films (Koren, Bell and Volinsky, 2009), and its test set held over 1.4 million recent ratings whose values were not published (Koren, 2008).

Known algorithms

AlgorithmTimeSpacePropertiesCode
Alternating least squares for matrix factorizationO(T (s r^2 + (m + n) r^3)) worstO((m + n) r + r^2) extrarandomizednot exactofflineiterative1 language
Bayesian personalized rankingO(T r + (m + n) r) expectedO((m + n) r) extrarandomizednot exactonlineiterative1 language
Weighted matrix factorization for implicit feedbackO(T (s r^2 + (m + n) r^3)) worstO((m + n) r + r^2) extrarandomizednot exactofflineiterative1 language
Item-based collaborative filteringO(n s + n^2 log n) worstO(n^2) extradeterministicexactofflineiterative1 language
Matrix factorization for recommendationO(E s r) worstO((m + n) r) extrarandomizednot exactofflineiterative1 language
Neural collaborative filteringO(E s (q + 1) (k + P)) worstO((m + n) k + P) extrarandomizednot exactofflineiterative1 language
Slope OneO(d) worstO(n^2) extradeterministicexactonlineiterative1 language
Sparse linear method for recommendationO(T n s) worstO(n^2 + m) extradeterministicnot exactofflineiterative1 language
SVD++O(E s d r) worstO((m + n) r) extrarandomizednot exactofflineiterative1 language
User-based collaborative filteringO(m n) worstO(m) extradeterministicexactonlineiterative1 language

Bounds

Since the target is future behavior, the problem has no complexity in the sense of an exact computational problem, and no method is optimal for all data. What can be stated:

  • Measured values. On the Netflix test set, the Netflix system Cinematch had an RMSE of 0.9514, and the grand prize asked for 0.8563, a 10 percent improvement (Koren, Bell and Volinsky, 2009). Koren (2008, Table 1) reports values from 0.9046 down to 0.8911 for factor models. These are measurements on one data set and one split.
  • Formulations with exact results. Once the problem is cast as fitting a low-rank matrix to the known entries, exact statements become possible: fitting the best rank-one matrix to a partly known matrix is NP-hard (Gillis and Glineur, 2011, see alternating least squares), and the theory of matrix completion gives conditions under which a low-rank matrix can be recovered from few entries.
  • The cost of methods. Each algorithm page gives the time and space of its method.

Reductions

Applications

Recommendation is used in online shops, where item-to-item methods suggest products related to those in a customer's history, in film, video and music services, and in news feeds. In search engines, the same signals of clicks are subject to position bias, which also affects implicit data for recommendation.

References

  1. Jonathan L. Herlocker, Joseph A. Konstan, Loren G. Terveen and John T. Riedl, Evaluating collaborative filtering recommender systems, ACM Transactions on Information Systems 22(1), 5-53, 2004, the user tasks of a recommender, the choice of data sets, the accuracy metrics for predicted ratings and for ranked lists, and the measures beyond accuracy
  2. Yehuda Koren, Robert Bell and Chris Volinsky, Matrix factorization techniques for recommender systems, IEEE Computer 42(8), 30-37, 2009, sections Recommender system strategies (content filtering and collaborative filtering, explicit and implicit feedback) and Netflix Prize competition (the size of the data, the RMSE of Cinematch and the target of the grand prize)
  3. Yehuda Koren, Factorization meets the neighborhood, a multifaceted collaborative filtering model, Proceedings of the 14th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD 2008), 426-434, the description of the Netflix test set (the Quiz set) and the validation set (the Probe set), and Table 1 (RMSE of factor models on the Netflix test set)
  4. Nicolas Gillis and François Glineur, Low-rank matrix approximation with weights or missing data is NP-hard, SIAM Journal on Matrix Analysis and Applications 32(4), 1149-1165, 2011, the main result (NP-hardness of low-rank approximation with missing data, already for rank one)
  5. Charu C. Aggarwal, Recommender Systems, The Textbook, Springer, 2016, Chapters 2 to 4 (neighborhood, model-based and content-based methods), Chapter 6 (hybrids) and Chapter 7 (evaluation)

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.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a contract.yaml