Search

Search papers and lessons

Implicit Feedback

Level 2 · 11 min read

Implicit feedback is behaviour a system records without asking, such as clicks, views and purchases; it is plentiful, but a missing event does not mean dislike.

On this page

  • Colour = topic mix
  • Linear algebra
  • Discrete math
  • Calculus
  • Neural network basics
  • Representation learning
  • Probability
  • ReadReady to readNot yet

TL;DR

Implicit feedback is behaviour a system records without asking the user anything: clicks, views, purchases, how long someone stayed on a page. It is cheap and abundant, but it only tells the system what happened, never what the user disliked. A missing event could mean "not interested", "never saw it" or "not yet", so a good model treats those gaps as uncertain rather than as zeros. This is what lets a shop or a video site learn taste from its ordinary logs.

Builds on: Recommender System, Matrix Factorization · Leads to: neural collaborative filtering, BPR

Where it's used

Online shops. A shop records every product page a customer opens, every item added to a basket and every purchase. Nobody rates anything, yet these logs are enough to suggest "customers who viewed this also bought that". Rendle and colleagues make the general point in their 2012 BPR paper: most real-world feedback is implicit, because clicks, view times and purchases are tracked automatically, while explicit ratings ask the user to stop and rate.

Video portals. A video site logs which videos a viewer started, how long they watched and whether they finished. A long watch is stronger evidence than a two-second preview, so the logged events differ in strength, and a model can use the counts to weight them.

News and web pages. Web servers already write every page request into a log file. A news site can turn those logs into a reader-by-article table of reads and train a recommender on it, with no survey and no rating buttons.

How it works

Take a tiny news site with four articles, A to D, and one reader, Ana. The log records how many times Ana opened each article.

  1. Turn the log into a table of counts. Ana opened A twice and D once. She never opened B or C. A zero here means "no event recorded", which is not the same as "dislikes". Check: Ana's counts are 2, 0, 0, 1 for A, B, C, D. Her total is 3 events.

  2. Turn each count into a confidence. Use the rule confidence = 1 + count, with a multiplier of 1 for now. A gets 1 + 2 = 3, B gets 1 + 0 = 1, C gets 1 + 0 = 1, D gets 1 + 1 = 2. More events make the system more sure that the signal is real. Check: a cell with no events still gets confidence 1, not 0.

  3. Turn each count into a preference. The preference is 1 if there was at least one event and 0 otherwise. Ana's preferences are 1, 0, 0, 1 for A, B, C, D. Check: D has only one event, yet its preference is 1 just like A's. The confidence, not the preference, carries the difference in strength.

  4. Fit a vector for the reader and for each article. Training adjusts the vectors so that each dot product lands near the preference, and each miss is weighted by its confidence. Suppose training ends with Ana = (1.0, 1.0), A = (0.6, 0.4), B = (0.2, 0.2), C = (0.15, 0.15) and D = (0.3, 0.3). Ana's predicted scores are then A 1.0, B 0.4, C 0.3, D 0.6. Check: B misses by 0.4 with weight 1, so it adds 1 × 0.4² = 0.16 to the loss. D misses by 0.4 too, but with weight 2, so it adds 0.32. The same size of miss costs twice as much on D because Ana interacted with it more.

  5. Score the unseen articles and rank them. Articles Ana has never opened are B and C. Their scores are B 0.4 and C 0.3, so B goes above C. D is already seen, so it is not recommended again. Check: 0.4 is larger than 0.3, so B is shown first.

flowchart LR
  A["Event log"] --> B["Counts per reader and article"]
  B --> C["Confidence and preference per cell"]
  C --> D["Fit vectors with weighted errors"]
  D --> E["Score unseen articles and sort"]

The math

Definition: Implicit feedback model

Let nui≥0n_{ui} \ge 0 be the number of events of user uu on item ii. Define the preference pui=1p_{ui} = 1 if nui>0n_{ui} > 0 and pui=0p_{ui} = 0 otherwise. Define the confidence cui=1+α nuic_{ui} = 1 + \alpha\, n_{ui} for a chosen constant α>0\alpha > 0. Find a user vector xu\mathbf{x}_u and an item vector yi\mathbf{y}_i, each of length kk, so that the dot product xu⋅yi\mathbf{x}_u \cdot \mathbf{y}_i approximates puip_{ui}, with each error weighted by cuic_{ui}.

Step 1 in symbols: the counts

nuin_{ui} is the count in cell (u,i)(u, i) of the log table, a sparse matrix when most cells are empty. In the example, nA,Ana=2n_{A,\text{Ana}} = 2 and nB,Ana=0n_{B,\text{Ana}} = 0.

Step 2 in symbols: the confidence

cui=1+α nuic_{ui} = 1 + \alpha\, n_{ui}

In the example, α=1\alpha = 1, so Ana's confidence for A is c=1+1⋅2=3c = 1 + 1 \cdot 2 = 3.

Step 3 in symbols: the preference

The preference is an indicator: 1 when the cell is nonempty, 0 otherwise.

pui={1if nui>00if nui=0p_{ui} = \begin{cases} 1 & \text{if } n_{ui} > 0 \\ 0 & \text{if } n_{ui} = 0 \end{cases}

Step 4 in symbols: the loss

Training minimises a weighted squared error summed over every cell, observed or not, plus a penalty on vector length:

L=∑u∑icui(pui−xu⋅yi)2+λ(∑u∥xu∥2+∑i∥yi∥2)\mathcal{L} = \sum_{u} \sum_{i} c_{ui} \left( p_{ui} - \mathbf{x}_u \cdot \mathbf{y}_i \right)^2 + \lambda \left( \sum_{u} \lVert \mathbf{x}_u \rVert^2 + \sum_{i} \lVert \mathbf{y}_i \rVert^2 \right)

The penalty λ\lambda is the usual L2 Regularization term, which keeps the vectors from memorising noise in the counts. This is the squared-error form that Hu, Koren and Volinsky introduced in 2008 for implicit data; the BPR paper calls it WR-MF and compares against it.

Step 5 in symbols: the ranking

For user uu, sort the unseen items by xu⋅yi\mathbf{x}_u \cdot \mathbf{y}_i from high to low and show the first few.

The pairwise alternative

Instead of weighting every cell, BPR (Rendle and colleagues, 2012) uses pairs. For user uu, observed item ii and unobserved item jj, let x^uij=xu⋅yi−xu⋅yj\hat{x}_{uij} = \mathbf{x}_u \cdot \mathbf{y}_i - \mathbf{x}_u \cdot \mathbf{y}_j. The criterion is

∑(u,i,j)ln⁡σ(x^uij)−λΘ∥Θ∥2,σ(x)=11+e−x\sum_{(u,i,j)} \ln \sigma\left(\hat{x}_{uij}\right) - \lambda_\Theta \lVert \Theta \rVert^2, \qquad \sigma(x) = \frac{1}{1 + e^{-x}}

where σ\sigma is the logistic function and Θ\Theta stands for all the model's parameters. Training maximises this, which pushes observed items above unobserved ones without ever calling the unobserved ones negative.

Worked examples

Example
1. One reader, one article, by hand

Take α=2\alpha = 2. A reader opened an article 3 times, and training has given the pair a predicted score of 0.5.

  1. Confidence: c=1+2⋅3=7c = 1 + 2 \cdot 3 = 7.
  2. Preference: p=1p = 1, since the count is positive.
  3. Weighted squared error: c (p−0.5)2=7⋅0.52=7⋅0.25=1.75c \,(p - 0.5)^2 = 7 \cdot 0.5^2 = 7 \cdot 0.25 = 1.75.
  4. Now take an unopened article with the same predicted score 0.5. Its count is 0, so c=1c = 1 and p=0p = 0.
  5. Its weighted squared error: 1⋅(0−0.5)2=0.251 \cdot (0 - 0.5)^2 = 0.25.

Interpretation: the same miss of half a point costs 1.75 on the observed cell and only 0.25 on the empty one. Training works hardest on what the reader actually did.

Example
2. A standard case: one reader's row

Ben's counts are 0, 3, 0, 1 for A, B, C, D. Use α=1\alpha = 1, so the confidences are c=1+nc = 1 + n, which gives 1, 4, 1, 2. The preferences are 0, 1, 0, 1. Suppose training gives Ben's predicted scores as A 0.2, B 0.9, C 0.5 and D 0.7.

  1. Errors p−r^p - \hat{r}: A 0−0.2=−0.20 - 0.2 = -0.2, B 1−0.9=0.11 - 0.9 = 0.1, C 0−0.5=−0.50 - 0.5 = -0.5, D 1−0.7=0.31 - 0.7 = 0.3.
  2. Weighted squared errors c⋅error2c \cdot \text{error}^2: A 1⋅0.04=0.041 \cdot 0.04 = 0.04, B 4⋅0.01=0.044 \cdot 0.01 = 0.04, C 1⋅0.25=0.251 \cdot 0.25 = 0.25, D 2⋅0.09=0.182 \cdot 0.09 = 0.18.
  3. Total loss on this row: 0.04+0.04+0.25+0.18=0.510.04 + 0.04 + 0.25 + 0.18 = 0.51.
  4. Unseen articles for Ben are A and C, with scores 0.2 and 0.5. Sorting puts C first, then A.

Interpretation: C is ranked above A even though Ben never opened it. Its score is high, and a zero on C only costs its weight of 1, so the model is not strongly punished for scoring an unseen article well.

Example
3. Realistic scale: a video portal

A video portal has 2,000,000 viewers and 20,000 videos. Suppose 40,000,000 viewer-video pairs have at least one watch event.

  1. Total cells in the table: 2,000,000×20,000=40,000,000,0002{,}000{,}000 \times 20{,}000 = 40{,}000{,}000{,}000, which is 4×10104 \times 10^{10}.
  2. Observed cells: 4×1074 \times 10^{7}. So only 4×107/4×1010=0.1%4 \times 10^{7} / 4 \times 10^{10} = 0.1\% of the table is observed.
  3. A full pass of the sum in Step 4 touches every cell, so it visits 4×10104 \times 10^{10} terms.

Try it: suppose training keeps each observed pair and adds 3 randomly chosen unobserved cells for each one, as in negative sampling. How many terms does a pass visit, and what fraction of the full pass is that?

Answer: the observed pairs give 4×1074 \times 10^{7} terms, and the 3 sampled cells per pair give 3×4×107=1.2×1083 \times 4 \times 10^{7} = 1.2 \times 10^{8} more, for 1.6×1081.6 \times 10^{8} terms in total. As a fraction of the full pass, 1.6×108/4×1010=0.0041.6 \times 10^{8} / 4 \times 10^{10} = 0.004, which is 0.4%.

Common mistakes and tradeoffs

It is tempting to think that a missing event means the user dislikes the item. In fact it means the system saw nothing, which covers "not interested", "never saw it" and "not yet". That is why an empty cell gets a small confidence of 1 rather than being treated as a confirmed zero with a large weight.

It is tempting to think that a click is a five-star rating. In fact clicks are noisy: an accidental tap, or a click followed by an immediate return. A count-based confidence lets repeated evidence count for more than a single event, without claiming that any one event is certain.

It is tempting to think that more events always means more liked. In fact popular items collect events from many people, partly because the shop shows them more often, so counts reflect exposure as well as taste. Check rankings on held-out events and watch whether popular items crowd out everything else.

When to use it: when you have logs and few or no ratings, which is the usual case for shops and video sites. When not to use it: when users give reliable explicit ratings, where a model that predicts the rating itself can fit better. Alternatives: BPR, which learns from pairs of items and avoids the zero-label question (BPR), and neural models that take the same events as input (neural collaborative filtering).

History

In 2006 Netflix offered a prize for predicting star ratings, which made matrix factorization the standard tool for recommenders (Recommender System). That work was about explicit ratings.

In 2008 Hu, Koren and Volinsky published a method for implicit data. They gave observed events a confidence that grows with the count and kept every other cell in the loss with a small weight. This is the weighting scheme used in the steps above.

In 2012 Rendle and colleagues published BPR, which replaces the cell-by-cell loss with a pairwise ranking criterion. It was aimed at settings like shops and video sites, which already log events and seldom have ratings to learn from.

Recap

  • Implicit feedback is logged behaviour (clicks, views, purchases) that carries no explicit rating.
  • Each cell gets a preference, which says whether anything happened, and a confidence, which grows with the count.
  • Empty cells are uncertain, low-weight evidence, not confirmed dislikes. The loss sums over all cells.
  • To recommend, score the unseen items with dot products and sort.
  • Pairwise methods such as BPR avoid the zero-label question by learning which of two items should rank higher.

Read next: neural collaborative filtering for a neural model on the same events, and BPR for the pairwise criterion.

Check yourself

QuestionWhat is the difference between an explicit rating and implicit feedback?Show answer

An explicit rating is a deliberate statement from the user, such as 1 to 5 stars. Implicit feedback is behaviour the system records, such as clicks, views and purchases. Implicit data has no true negatives: a missing event does not say the user dislikes the item.

QuestionWith α=2\alpha = 2, what is the confidence for a cell with 4 events? And what is the weighted squared error for a cell with 0 events whose predicted score is 0.5?Show answer

Confidence: c=1+2⋅4=9c = 1 + 2 \cdot 4 = 9. Error for the empty cell: the confidence is 11 and the preference is 00, so the weighted squared error is 1⋅(0−0.5)2=0.251 \cdot (0 - 0.5)^2 = 0.25.

QuestionWhy does an empty cell get confidence 1 instead of 0?Show answer

If empty cells had confidence 0, the loss would ignore them entirely, and the model could give every unseen item a high score at no cost. With confidence 1, scoring an unseen item high is penalised, but only weakly, because the system does not know that the item was rejected. The weight encodes that uncertainty.

QuestionA bookshop logs both ‘added to basket’ and ‘bought’. Which should get the larger count multiplier, and why?Show answer

A purchase is a stronger and rarer signal than a basket addition, so it should usually get the larger multiplier. The exact choice is a design decision, and it should be checked on held-out purchases rather than assumed.

Sources