A retailer's click model has 200M impressions, 2M of them clicks. To cut training cost, you keep every click and 1 in 10 non-clicks, and give each kept non-click a weight of 10 in the log loss. Which statement about the resulting training set and model is correct?
Show the answer and explanation
Correct answer: D, 21.8M rows, about 9× fewer; the weighted click share is 2M / (2M + 10 × 19.8M) = 1%, so the predicted probabilities stay calibrated to the true click rate with no correction.
Explanation Class Imbalance
This is the downsample-and-upweight recipe for very large, imbalanced logs:
- Downsample the majority class: keeping 1 in 10 of the 198M non-clicks leaves 19.8M. Training rows drop from 200M to 2M + 19.8M = 21.8M, about 9× fewer, and the majority class itself shrinks 10×.
- Upweight each kept majority row by the same factor, 10, in the loss.
Each kept non-click now stands in for itself and nine dropped ones, so the weighted log loss is an unbiased estimate of the loss on the full data. The weighted click share is 2M / (2M + 10 × 19.8M) = 2M / 200M = 1%, the true base rate, so the probabilities need no prior correction.
| Setup | Rows | Effective click share |
|---|---|---|
| Full data | 200M | 1% |
| Downsample only | 21.8M | 2 / 21.8 ≈ 9.2% (probabilities inflated) |
| Downsample + weight 10 on kept non-clicks | 21.8M | 1% |
| Downsample + weight 10 on clicks | 21.8M | 20 / 39.8 ≈ 50% |
Why the other statements fail: the ≈ 9.2% share describes unweighted downsampling, which does need a prior correction; the weights undo exactly that shift. A weight scales a row's contribution to the loss and gradient, but the optimizer still reads only 21.8M rows, so the speed-up is real. Upweighting the clicks instead would push the effective click share to about 50% and inflate the predictions even more.
The cost is higher gradient variance from the weighted rows, so keep the factor moderate and still check calibration on an untouched validation set.
Interview tip: "downsample for speed, upweight for calibration", and evaluate and tune thresholds on data at the real 1% click rate.