Offline Metrics and Online Outcomes

An offline score evaluates predictions on a particular dataset. A service outcome depends on which actions those predictions trigger, who receives them, and what happens afterward. The simulations below examine exposure bias, limited action capacity, and unequal outcome value. They illustrate reasons an offline improvement may not translate into an operational gain; they do not measure how often this happens in deployed systems or rule out drift and training-serving skew.

Predicting logged clicks and choosing new positions

Clicks depend on both item relevance and where an item was displayed. The first model receives the incumbent rankerโ€™s position as a feature; the second receives only item features. Position is useful for predicting clicks under the old display policy. When a new ranker chooses the positions, however, those old positions are not fixed attributes of the candidate items. A position-aware response model may still be useful if it evaluates proposed placements explicitly.

Each query contains ten candidates, and the split keeps complete queries together. The simulator multiplies item attractiveness by 1/(1+position) to obtain a click probability. It permits multiple clicks per query and omits interactions between displayed items. Scoring model A with position fixed at zero defines a candidate-ranking rule; it is not a general correction for position bias.

import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score

g = np.random.default_rng(0)
n_q, per_q = 20000, 10
n = n_q * per_q
rel = g.normal(size=n)                                  # true relevance
x = np.c_[rel + g.normal(0, 0.6, n), g.normal(size=n)]  # observable item features

inc = rel + g.normal(0, 1.0, n)                         # the incumbent ranker
pos = np.concatenate([np.argsort(np.argsort(-inc[q * per_q:(q + 1) * per_q]))
                      for q in range(n_q)])
examine = 1.0 / (1.0 + pos)                             # lower slots are seen less
click = (g.random(n) < examine * 1 / (1 + np.exp(-(1.2 * rel)))).astype(int)
print(f"click rate {click.mean():.4f};  at position 0 {click[pos == 0].mean():.4f},"
      f" at position 9 {click[pos == 9].mean():.4f}")

split = int(0.7 * n)
featA = np.c_[x, pos]                                   # A also sees the slot
mA = LogisticRegression(max_iter=2000).fit(featA[:split], click[:split])
mB = LogisticRegression(max_iter=2000).fit(x[:split], click[:split])
sA = mA.predict_proba(featA[split:])[:, 1]
sB = mB.predict_proba(x[split:])[:, 1]
print(f"OFFLINE, predicting logged clicks:  A {roc_auc_score(click[split:], sA):.4f}"
      f"   B {roc_auc_score(click[split:], sB):.4f}")

sA_on = mA.predict_proba(np.c_[x[split:], np.zeros(n - split)])[:, 1]
rel_hi = (rel[split:] > np.quantile(rel[split:], 0.8)).astype(int)
print(f"SIMULATED relevance-label AUC:  A {roc_auc_score(rel_hi, sA_on):.4f}"
      f"   B {roc_auc_score(rel_hi, sB):.4f}")
heldout_relevance = rel[split:].reshape(-1, per_q)
attractiveness = 1 / (1 + np.exp(-1.2 * heldout_relevance))
for name, scores in (("A", sA_on), ("B", sB)):
    order = np.argsort(-scores.reshape(-1, per_q), axis=1)
    ranked = np.take_along_axis(attractiveness, order, axis=1)
    expected = (ranked / (1 + np.arange(per_q))).sum(1)
    print(f"{name}: simulated expected clicks/query {expected.mean():.4f}; top-slot click probability {ranked[:, 0].mean():.4f}")
# click rate 0.1788;  at position 0 0.7457, at position 9 0.0246
# OFFLINE, predicting logged clicks:  A 0.8375   B 0.7468
# SIMULATED relevance-label AUC:  A 0.9266   B 0.9267
# A: simulated expected clicks/query 1.8596; top-slot click probability 0.7997
# B: simulated expected clicks/query 1.8595; top-slot click probability 0.7995

The logged-click AUC is 0.8375 for A and 0.7468 for B. After reranking, their simulated expected clicks per query are 1.8596 and 1.8595; these are model-based expectations, not online observations. The relevance AUC uses a different label: whether latent relevance falls in the top fifth of held-out items. These two AUCs answer different questions, so subtracting their model gaps is not a measured offline-to-online performance loss. The query-level calculation instead reranks each ten-item candidate set and computes expected clicks under the simulatorโ€™s known examination model.

The logged data have a much higher click rate in the first slot than in the last. That contrast reflects both examination probability and the incumbentโ€™s relevance ordering; it does not establish that position explains most click variance. The held-out queries support an offline comparison, but no significance test was run. Uncertainty for a paired ranking comparison should account for the query grouping.

For each feature, determine when its value becomes known and how it would change under the proposed action. Stock known before ranking can be a valid input; stock observed afterward can be an outcome of the decision. A historical price may be known before todayโ€™s prediction, while a newly selected price is part of the action. Randomized exposure or a justified examination model can help separate relevance from position effects, provided the required support and observation assumptions hold. They do not automatically identify every counterfactual ranking outcome.

AUC and a capacity-limited decision

Here capacity k means selecting exactly k opportunities from 200,000 candidates. The simulator knows each candidateโ€™s success probability and generates one binary outcome. It adds scaled versions of the same random score-error vector to create a family of rankings. Scores are not necessarily probabilities; AUC and top-k selection use only their ordering.

g = np.random.default_rng(0)
n = 200_000
p_true = g.beta(1.5, 12, n)
y = (g.random(n) < p_true).astype(int)
k = n // 100
oracle_idx = np.argsort(-p_true)[:k]
oracle_expected = p_true[oracle_idx].sum()
random_expected = p_true.mean() * k
score_error = g.normal(size=n)
print(f"observed base rate {y.mean():.4f}; capacity {k}; oracle expected successes {oracle_expected:.1f}")
print("score noise | AUC | expected successes | realized successes | expected/random")
for noise in (0.0, 0.02, 0.05, 0.10, 0.25, 1.0):
    score = p_true + noise * score_error
    top = np.argsort(-score)[:k]
    expected = p_true[top].sum()
    print(f"{noise:11.2f} | {roc_auc_score(y, score):.4f} | {expected:18.1f} | {y[top].sum():18d} | {expected/random_expected:15.2f}")
# observed base rate 0.1113; capacity 2000; oracle expected successes 843.7
# score noise | AUC | expected successes | realized successes | expected/random
#        0.00 | 0.7229 |              843.7 |                888 |            3.79
#        0.02 | 0.7153 |              836.6 |                878 |            3.76
#        0.05 | 0.6885 |              800.0 |                834 |            3.59
#        0.10 | 0.6424 |              692.1 |                720 |            3.11
#        0.25 | 0.5724 |              437.7 |                442 |            1.97
#        1.00 | 0.5187 |              265.2 |                267 |            1.19

The score using \(p_{\mathrm{true}}\) orders items by their actual conditional success probabilities. Under this Bernoulli model, that ordering is optimal for population AUC among scores based on information available before the outcome. Its measured AUC on these realized labels is an estimate, not a finite-sample ceiling: another ranking can happen to score higher on one draw. The labels remain random even at known p, so a population AUC below 1 does not itself indicate estimation error.

At zero score noise, the selected set has 843.7 expected successes and 888 realized successes. The difference is outcome noise, not an improvement over the oracle. The table separates expected successes, summed from the known probabilities, from realized successes in one label draw. Selecting the largest probabilities maximizes the expected total for a fixed number of independent opportunities; it need not achieve the largest realized count on every draw. These rows describe one family of perturbed scores at one capacity. There is no universal AUC-to-conversion curve: AUC depends on all positiveโ€“negative pair orderings, while a top-k policy depends only on the selected set. Reordering items outside that set can change AUC without changing its outcome.

The random-selection baseline is k times the average success probability on these candidates. Its ratio to a policyโ€™s expected total gives expected lift over uniform selection, not incremental lift over an existing production system. The synthetic y values describe successes among selected opportunities. If an action such as sending an offer changes the probability of conversion, predicting who converts is not enough to estimate which conversions the action causes.

EvidenceWhat it measuresWhat still needs checking
AUC on logged outcomesRanking of labels under the logging processExposure, selection, feature timing, and the intended policy
Precision or successes at capacityOutcomes among the chosen itemsActual capacity, label quality, intervention effects, and costs
Expected net valueA model-based estimate for the selected actionsProbability and value models, constraints, and uncertainty
Randomized online experimentEffects under its assignment and observation protocolValidity, uncertainty, interference, duration, and rollout conditions

From a score to a deployment decision

Define the action and outcome before choosing a metric. A fraud queue with 200 review slots needs an assessment of the selected alerts, investigation cost, and avoided loss. A recommendation system may need margin or retention alongside clicks.

Offline evaluation can screen candidates on representative data and reproduce the intended decision rule. A shadow run can check serving behavior without changing user actions, but cannot measure the causal effect of the new actions. A randomized test can estimate that effect under its design. Predefine a primary outcome, guardrails, sample size, and stopping rule; report effect sizes and intervals. Limited duration, interference, selection, or changes at full rollout can limit what the result predicts beyond the experiment.

References

For experimental allocation and interim decisions, see A/B Testing and Experiment Design; for evaluating policies from logged actions, see Bandits and Exploration.


Discover more from Insightful Data Lab

Subscribe to get the latest posts sent to your email.

Similar Posts

Questions, corrections, or additional insights?

This site uses Akismet to reduce spam. Learn how your comment data is processed.