How do we evaluate the basic recommender framework? Any ideas?
There are three main paradigms:
Offline analytics
Assess algorithms on a dataset of behaviour that was collected in advance.
User study
Recruit testers who perform tasks with the recommender, and observe them.
Online experiment
Test on a deployed system, with real users and real tasks.
Offline Analytics
Logged behaviour
Interaction data is collected in advance.
Simulation
Replay the users against each algorithm.
Selection
Filter and keep only the promising algorithms.
Offline Analytics
Common practice
Offline analytics is also standard in machine learning: the testing method typically involves cross-validation.
Advantages
✓It does not require interaction from real users.
✓It is cost-effective and allows quick testing and comparison of many algorithms.
Limitations
✕Limited for evaluating serendipity or novelty.
✕It might not reflect changes in the distribution of tastes.
Offline metrics are a proxy: a better score on past data does not guarantee more satisfied users.
User Study
Recruit
Testers are recruited to perform tasks with the recommender, and the study must consider the distribution of the testers, including demographic factors.
Observe and record
•Which tasks were completed?
•How much time was spent on each task?
•How accurate are the results of the tasks?
Ask
•Their preferences about the user interface.
•Their perception of the complexity of the tasks.
Qualitative data are often crucial to explain the quantitative results.
User Study
Example
Testers use two recommenders to find a film to watch. We compare the time taken and the satisfaction.
Advantages
✓Shows the user experience: satisfaction, trust.
✓Explains why: the reasons behind the numbers.
Limitations
✕The cost is very high.
✕A large number of testers must be recruited.
✕Testers must finish many interaction tasks.
Trade-off
cost × guarantee of statistical significance × quality of the data
Online Experiment
Deployed system
A large-scale test on a deployed recommender, with real tasks performed by actual users.
Advantages
✓The most realistic results of the three methods.
✓Assesses overall performance: long-term profit and user retention.
Limitations
✕Recommenders may suggest unrelated items during the experiment.
✕Ethical concerns may arise.
Parameters
Cross-validationBalance among the business metricsselects the parameters and algorithms.
Online Experiment
Aim
Measure how an algorithm changes what users do, by comparing users who receive different algorithms.
Fair comparison
•Users are assigned to the recommenders at random.
•The interface and the other factors are the same for all.
Example
Each algorithm recommends five items; we count the clicks.
Algorithm A
1 of 5: 20%
Algorithm B
4 of 5: 80%
Algorithm B is more effective than A, provided that the difference holds for many users.
Online experiments are often the final step among the three types of evaluation.
A/B Testing
A/B test
A controlled experiment: users are randomly assigned to the current system (A) or to the new one (B), and we compare an outcome.
Users
arrive at the site
Random split
50% / 50%
A: control
the current recommender
B: treatment
the new recommender
Metric per user
for instance, clicks
Compare
mean of B against mean of A
Why randomise?
Random assignment makes the two groups alike in everything else (all else being equal), so a difference in the outcome is caused by the change.
A/B Testing: What We Estimate
Two potential outcomes
Each user has an outcome under the control, $Y_C$, and one under the treatment, $Y_T$, but we observe only one of them.
Example
Clicks of four users; the other outcome stays unknown.
group
$Y_C$
$Y_T$
user 1
A
3
?
user 2
B
?
5
user 3
A
0
?
user 4
B
?
2
Average treatment effect
The true effect, with infinitely many users: $$\Delta = \mathbb{E}[Y_T - Y_C] = \mu_T - \mu_C$$
We estimate it with the difference of the sample means of the two groups: $$\hat\Delta = m_T - m_C$$
Randomisation makes $m_T$ and $m_C$ unbiased estimators of $\mu_T$ and $\mu_C$.
A/B Testing: Measuring Each User
The sample
When users are randomised, each sample is the outcome $Y$ of one user, measured once in the experiment.
A fixed observation window
Each user is measured over the same window, from the first exposure.
Rules
•The value of a user may be updated while new events arrive, but only inside the window.
•When the window ends, the value is frozen.
•Letting early users accumulate longer biases the comparison.
A/B Testing: Uncertainty
Uncertainty
The measured effect $\hat\Delta$ depends on which users were drawn: it is a random variable.
Sampling distribution of the measured effect
Central limit theorem
For large samples, approximately $$\hat\Delta \sim \mathcal{N}\!\left(\Delta,\ \frac{\sigma_T^2}{n_T} + \frac{\sigma_C^2}{n_C}\right)$$
The standard error shrinks like $1/\sqrt{n}$: more users, a narrower curve.
A/B Testing: The Null Hypothesis
Null hypothesis
$H_0: \Delta = 0$, there is no effect. Is the measured effect too large to be explained by chance alone?
Example: standard error 0.18
The curve shows how likely each measured $\hat\Delta$ is if we repeated the test many times when there is truly no effect: values near 0 are common, large ones are rare. The total area is 1, and the red tails hold $\alpha = 5\%$ of it.
•Otherwise we fail to reject $H_0$: we never prove that there is no effect.
A/B Testing: Power
Alternative hypothesis
Suppose there is a real effect $\Delta^\star$. Will the test detect it?
Example: true effect 0.50
If the true effect is $0.50$ and the standard error is $0.18$, the measured $\hat\Delta$ varies around it. We detect the effect when $\hat\Delta$ lands beyond the critical value, and miss it when it lands below.
With twice the users per group the standard error falls to 0.13: both curves narrow, the critical value moves to 0.25 and the power rises to 0.98.
Type II error and power
The power is the probability that the test detects an effect that is really there.$$\beta = P(\text{fail to reject } H_0 \mid H_1 \text{ true})$$ $$\text{power} = 1 - \beta$$
The power grows with:
↑the sample size $n$
↑the true effect $\Delta^\star$
↑a smaller variance $\sigma^2$
↑a larger $\alpha$
A/B Testing: Design
Overall evaluation criterion (OEC)
One pre-specified metric on which we decide to ship or not; it must be close to the change, stable, and defined per user over a fixed window.
We may also track guardrail metrics (safety checks, such as errors or latency) and secondary metrics, but the test is designed for the OEC.
Minimum detectable effect (MDE)
The smallest true effect that the test detects with power $1-\beta$ at level $\alpha$:$$\delta = \big(z_{1-\alpha/2} + z_{1-\beta}\big)\sqrt{\frac{\sigma_T^2}{n_T} + \frac{\sigma_C^2}{n_C}}$$
Here $z_q$ is the quantile $q$ of the standard normal curve: $z_{0.975} = 1.96$ for $\alpha = 0.05$, and $z_{0.80} = 0.84$ for power $0.80$. $\sigma^2$ is the variance of the metric and $n$ the number of users in each group.
The MDE on the curves
$\delta = (1.96 + 0.84) \times \mathrm{SE} = 2.80 \times 0.18 \approx 0.50$: the smallest effect whose curve puts 80% of its area beyond the critical value.
More users, smaller MDE
Higher variance or stricter $\alpha$ and power give a larger MDE.
A/B Testing: Checklist
How to run an A/B test
Make the trade-offs explicit before spending the traffic.
Checklist
1
Define the OEC: one primary metric, over a fixed window
2
Set the MDE: the smallest effect worth detecting
3
Configure: $\alpha$, power, allocation and duration
4
Estimate the sample size: from the mean and variance of recent data
5
Plan the analysis: fixed horizon, or a sequential method
6
Pre-register: metrics, success criteria and analysis, before the start
Pitfalls
✕Peeking: stopping as soon as the result looks significant raises the false discoveries.
✕Low power: real effects are missed, and significant lifts are often exaggerated.
✕Unequal observation windows, or unequal splits without a reason.
✕Claims on many metrics without a correction for multiplicity.
Best Practices in Recommender Evaluation
1
Offline analytics
Evaluate and compare many algorithms on collected data.
2
User study
Record how different users interact with the systems that remain.
3
Online experiment
Select the most suitable recommender with real users.
Machine Learning Perspective
Loss
A model is trained by minimising a loss: the distance between the prediction $\hat{X}_{ij}$ and the real value $X_{ij}$.
Explicit feedback
Matrix factorisation uses the squared loss on the observed ratings.
Other models use other losses, for instance the cross-entropy for binary feedback.
Prediction accuracy
We want to know how well the algorithm fits the data: the same distance, on held-out data.
Machine Learning Perspective
1
Dataset
Ratings of users for items.
2
Split
Training and test sets; the same split for all algorithms.
TrainTest
3
Predict
Train, then predict the test set.
4
Error
Predicted against actual rating.
$|X_{ij} - \hat{X}_{ij}|$
Machine Learning Perspective
Machine learning metrics
Let $X_\Omega$ be a partially observed matrix, where we observe the entries in the set $\Omega$. Let $\Omega_{\mathrm{train}}$ and $\Omega_{\mathrm{test}}$ be the entries of the training and test sets, with $\Omega = \Omega_{\mathrm{train}} \cup \Omega_{\mathrm{test}}$. The main metrics of the machine learning perspective are computed on the test set, where $|\Omega_{\mathrm{test}}|$ is its size.
For a user, it is often hard to tell the relevant items from the non-relevant ones.
?
?
?
?
?
✓ consumed: relevant
? not consumed: irrelevant, or just never seen?
Even in online experiments, computing such metrics is not always feasible, or meaningful.
Approximations
We use approximations: recall and precision are the key metrics (the F1-score only occasionally), restricted to the top-K recommendation.
Information Retrieval Perspective
Precision and Recall in Recommenders
Precision@K
measures the accuracy of the top K recommendations:$$\mathrm{Precision@}K = \frac{\text{TP in the top } K}{K}$$
Recall@K
measures the ability to capture the relevant items within the top K recommendations:$$\mathrm{Recall@}K = \frac{\text{TP in the top } K}{\text{number of relevant items of the user}}$$
We normally report the average of recall or precision over the users of the test set.
Precision@K and Recall@K
Precision and Recall: The Order
Setting
A user has 3 relevant items. We recommend K = 10 items, in two different orders.
first position✓ relevant ✕ not relevantlast position of the top K
the cumulative gain of the top K items, with smaller contributions for the items lower in the list.$$\mathrm{DCG@}K = \sum_{p=1}^{K} \frac{rel_p}{\log_2(p+1)}$$
IDCG: ideal DCG
the DCG of the ideal ranking, in which the relevant items come first; $rel'_p$ is the relevance at position $p$ of that ranking.$$\mathrm{IDCG@}K = \sum_{p=1}^{K} \frac{rel'_p}{\log_2(p+1)}$$
NDCG@K
Coverage
Item coverage
Item coverage is the proportion of the items that are recommended, out of all the items that are available.
Meaning
It shows the ability of the system to cover a broad range of items. A good system aims at both high prediction accuracy and broad coverage.
Coverage
Let $n$ be the number of items and $\hat\Omega^i$ the set of items recommended to the user $i$:$$C = \frac{\left|\bigcup_i \hat\Omega^i\right|}{n} = \frac{5}{12} = 0.42$$
Perspective of Human Interaction
A perfect system?
Can we consider a system perfect when $\mathrm{NDCG} = \mathrm{Recall} = C = 1$?
Not necessarily: recommender systems operate in dynamic environments.
Example
A user has just bought a new smartphone in an online store.
More smartphones
smartphonesmartphonesmartphone
✕ accurate, but not now
Accessories
casechargerearphones
✓ timely and relevant
More metrics
From the perspective of human interaction:
diversitytrustnoveltyserendipity
Diversity
Diversity
The opposite of similarity: the items of a list should differ from one another.
•Accuracy is not enough: diversity meets the varying needs of the users.
•It helps to mitigate ethical concerns, such as filter bubbles.
A common measure
The intra-list diversity: the average dissimilarity of the pairs of items in the list of $K$ items:$$\mathrm{ILD} = \frac{\sum_{j < l} \big(1 - \mathrm{sim}(j, l)\big)}{K(K-1)/2}$$
Trust
Trust
The level of trust that users have in the recommendations of the system.
Example: an explanation
A transparent and reasonable reason for the recommendation.
Recommended for you
Casablanca
Why?Because you liked Titanic and other classic romances.
What builds trust
•Familiar items: users who see items that they know and appreciate trust the system more.
•Explanations that are transparent and reasonable.
•Measured with user surveys about the trust in the recommendations.
Novelty
Novelty
Recommending items that users are not familiar with.
Popularity as a proxy
How to promote and measure it
•Filter out the items that the user has already bought or rated: simple, but not foolproof, since a user may know an item without having consumed it.
•Prefer less popular items, which add to the sense of novelty.
•User surveys, to check that the recommended items are new to the users.
Serendipity
Serendipity
The quality of pleasant surprise and unpredictability in the recommendations.
Expected
A recent film of the favourite actor of the user.
not novel
Novel
An early film of the same actor, that the user did not know.
new, but expected
Serendipitous
A film that the user would never have looked for, and loves.
new and a pleasant surprise
Novelty introduces new content; serendipity adds the layer of pleasant surprises.
Evaluation
The dissimilarity between the recommended items and the previous preferences of the user, together with the satisfaction of the user with the recommendations.
Perspective of Software Engineering
Software engineering
A good model is not enough: the recommender has to run fast, keep running, and grow with the data.
Example
An accurate and diverse algorithm may be too computationally expensive to run in real time.
Availability
Recommender systems are expected to be highly available, often working continuously.
Real-time performance
Respond quickly, to new items and to new behaviour.
Robustness
Resist false information and extreme events.
Scalability
Keep accuracy and speed as the data grows.
Real-Time
Why
Items such as news and new arrivals lose value quickly: recommending them promptly attracts traffic.
Two aspects
•Real-time recommendations for newly added items.
•Real-time recommendations based on the behaviour of the user, such as purchases or clicks.
How to evaluate it
Robustness
Robustness
Stability when faced with false information that aims to influence the results.
Why it matters
•Many recommenders rely on the behaviour of users, such as purchases or clicks, which makes them vulnerable.
•Attacks are false changes in the behaviour of users that affect the recommendations.
•Abnormal behaviour can be detected, for instance with attack models or anomaly detection.
Example: fake users
A hotel manager registers fake users to raise the rating of hotel A and to lower that of the competitor B.
Hotel A
3★4★3★5★5★5★
average 3.33 → 4.17
Hotel B
4★4★5★1★1★1★
average 4.33 → 2.67
Robustness is the ability to resist such cheating.
Robustness
Extreme events
Robustness is also stability against extreme events, such as a massive influx of user requests in a short time.
Example
What helps
•The infrastructure and the architecture of the system: the scale and reliability of the hardware, the database software, and so on.
•Recommendation algorithms designed for parallel computing tend to be more robust in such scenarios.
Scalability and Resource Management
Scalability
A critical consideration: the consumption of resources must be monitored while the system runs.
At launch
When a system is newly launched, its database (the numbers of items and users) is small and may contain simulated data.
Example: two algorithms A and B
A is more accurate on a small database, B catches up as it grows while A becomes much slower: it is difficult to say which algorithm is better.
Business Perspective
Business success
A fundamental goal of recommender systems: evaluation plays a pivotal role in reaching it.
Conversion rate
The percentage of users who acted on the recommendations, for instance by making a purchase or subscribing.
Revenue generation
The direct impact of the recommendations on sales and revenue.
Customer lifetime value (CLV)
The long-term value of the users acquired through the recommendations.
Retention rate
How well the recommendations retain and engage users over time.
Beyond metrics
The alignment of the recommendations with the business objectives, the engagement of users and customer satisfaction are also critical aspects of evaluation.