23/31
Part 6 of 6 · What interviewers ask nextLearn and do

A swap shows one listing at two ranks, so only the look changes

Of those three ways, the swap is the one to explain at the board.

RankMost trafficA small slice, swapped with rank 3
1listing Alisting C
2listing Blisting B
3listing Clisting A: the same listing, now at rank 3

It's the same listing at two positions, so the same relevance. A's click rate at rank 3 over its rate at rank 1 estimates p3/p1p_3 / p_1, and a swap with any rank jj gives pj/p1p_j / p_1.

Agarwal and coauthors show how to harvest that kind of swap from the logs of several past rankers, with no new experiment. The condition is that which ranker served a query must not depend on the query. An A/B test guarantees that by randomizing.

In the simulation, shuffling the top 4 and swapping both came back within 0.01 of the true propensities. Both cost something while they run: about a fifth fewer clicks on the queries in the experiment, because worse items moved up. Keep the slice small.

Swaps and harvested data give each propensity relative to the top, pk/p1p_k / p_1. The practice uses the same scale: propensity[0] is 1.0. So the estimate is the click rate the item would get if every impression sat at the top. To compare items or rankers, the scale does not matter. Scaling every propensity by the same number scales every estimate the same way.

In the editor, write swap_propensities(log). log holds one (rank, clicked) pair for every impression of one listing: rank 1 on most traffic, and ranks 3 and 4 on the swapped slice. Return its click rate at each rank over its click rate at rank 1.