Fraud Scorer: Picking a Decision Threshold with Asymmetric Costs
Machine LearningModel answerLast updated
Select and justify an operating threshold for a fraud probability scorer given asymmetric FP/FN costs, then cover calibration, drift monitoring, and safe rollout.
Fraud Probability Scorer: Threshold Selection Under Asymmetric Costs
You maintain a binary fraud classifier that outputs a probability score for each payment transaction. Your job is to choose an operating threshold that minimizes expected business cost and to design the surrounding infrastructure to keep it well-calibrated and safe to update over time.
Setup
Per 1,000,000 transactions, assume:
- Base fraud rate: 0.20% (2,000 fraudulent, 998,000 legitimate)
- Cost of a false positive (blocking a legitimate transaction): $15
- Cost of a false negative (approving a fraudulent transaction): $100
Three candidate thresholds have been evaluated on a representative validation set:
| Threshold | TPR | FPR |
|---|---|---|
| T1 | 0.90 | 0.020 |
| T2 | 0.80 | 0.010 |
| T3 | 0.65 | 0.004 |
What you are expected to address
Part 1 — Threshold selection. For each candidate, compute the expected TP, FP, FN, TN counts and total cost per million transactions. Identify which threshold minimizes expected cost and explain the business trade-offs. Derive the general optimality condition from first principles and discuss sensitivity to cost assumptions.
Part 2 — Score calibration and drift monitoring. Explain how you would verify and maintain score calibration (covering at least two calibration methods), detect distribution and label drift given that fraud labels mature with a 30–90 day delay, and distinguish prior shift from concept drift.
Part 3 — Segment-level re-tuning and guardrails. Describe how you would set different thresholds for distinct segments (e.g., by country, merchant category, transaction amount). Propose guardrail metrics to catch harmful side effects — particularly on high-value customers — and outline an experiment design that validates threshold changes without creating unacceptable customer friction.
Hints
Hint 1
Remember that FPR is a rate over the negative population and TPR is a rate over the positive population. With a 0.20% fraud rate, even a small FPR generates a very large absolute FP count — get the denominators right before computing costs.
Hint 2
The cost-optimal point on the ROC curve is where its local slope equals (C_FP × N) / (C_FN × P). Compute this target slope and compare it to the chords between your three candidate points to reason about whether T3 is truly the global optimum or just the best of the three.
Hint 3
For calibration, ask yourself what happens when the model was trained on downsampled negatives — the raw output scores will not match real-world probabilities without a correction step. For drift, separate leading indicators (score distributions, feature shifts) that are available in near-real-time from lagging indicators (precision/recall on matured labels) that only arrive weeks later.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Part 1: Confusion Matrix and Cost Analysis
Computing the expected counts
With a 0.20% fraud rate over 1,000,000 transactions:
- Positives P = 2,000 (fraud)
- Negatives N = 998,000 (legitimate)
For each threshold:
- TP = TPR × P
- FN = P − TP
- FP = FPR × N
- TN = N − FP
- Total cost = $15 × FP + $100 × FN
| Threshold | TP | FN | FP | TN | FP cost | FN cost | Total cost | Precision |
|---|---|---|---|---|---|---|---|---|
| T1 (TPR 0.90, FPR 0.020) | 1,800 | 200 | 19,960 | 978,040 | $299,400 | $20,000 | $319,400 | 8.3% |
| T2 (TPR 0.80, FPR 0.010) | 1,600 | 400 | 9,980 | 988,020 | $149,700 | $40,000 | $189,700 | 13.8% |
| T3 (TPR 0.65, FPR 0.004) | 1,300 | 700 | 3,992 | 994,008 | $59,880 | $70,000 | $129,880 | 24.6% |
T3 minimizes expected cost at ~$130k per million transactions, roughly $60k cheaper than T2 and $190k cheaper than T1.
Why T3 wins: marginal analysis
Moving from T2 to T3, you give up 300 caught frauds (+$30k FN cost) but avoid 5,988 unnecessary declines (−$89.8k FP cost) — a net gain of ~$60k. Each additional fraud miss "buys" about 20 fewer false declines at $15 each ($300 of saved friction), three times the $100 FN penalty.
General optimality condition
The cost-optimal point on the ROC curve satisfies:
dTPR/dFPR = (C_FP × N) / (C_FN × P)
= (15 × 998,000) / (100 × 2,000)
≈ 74.9
The chord slope from T2 to T3 is only (0.80 − 0.65) / (0.010 − 0.004) = 25, well below 74.9. This means pushing to a stricter threshold than T3 may still reduce cost. With three discrete candidates we cannot know; in practice you sweep the full ROC curve and find the exact crossing point.
With calibrated scores you can derive the equivalent probability cutoff directly: block when p × C_FN > (1 − p) × C_FP, giving p* = 15 / (15 + 100) ≈ 0.13.
Sensitivity and business trade-offs
A single global threshold is a simplification. Several assumptions are fragile:
- C_FN is transaction-dependent. For a $2,000 electronics purchase, the fraud loss alone can exceed $300, making T2 or even T1 cheaper for that segment.
- C_FP understates churn. The $15 figure is lost margin on one transaction. For a long-tenure customer, a false decline can cost hundreds in lifetime value. That shifts the optimal threshold upward (more permissive).
- A soft decline is not the only option. A step-up challenge (SMS OTP, 3-D Secure) costs $1–3 in friction and recovers fraud without a hard decline. Model this as a third action for the uncertain band around p*.
Common mistake: applying FPR to all 1,000,000 transactions instead of the 998,000 legitimate ones, or confusing TPR and recall (they are the same thing here). The asymmetry of the base rate is what makes false positives dominate cost — always sanity-check absolute counts, not just rates.
Part 2: Calibration and Drift Monitoring
Score calibration
Threshold math only works if model scores are true probabilities. Two standard post-hoc calibration methods:
- Platt scaling fits a logistic function to the raw model output. It is stable with limited data and works well when the score distortion is roughly sigmoid-shaped. Suitable for fraud where positives are sparse.
- Isotonic regression is a non-parametric monotone fit. It is more flexible but will overfit with few positives. Reserve it for settings where you have tens of thousands of positives in the calibration set and validate with k-fold to avoid overfitting.
Important: if the model was trained on downsampled negatives (common in fraud), raw scores must be corrected before calibrating:
p_true = p_s / (p_s + (1 − p_s) / w)
where w is the negative subsampling rate. Skipping this correction produces systematically overconfident scores and an inflated optimal threshold. Evaluate calibration using reliability diagrams, expected calibration error (ECE), and Brier score — both globally and within key segments, since global calibration can mask segment-level miscalibration.
Monitoring with delayed labels
Fraud chargebacks mature over 30–90 days. You cannot wait that long to detect problems, so you split monitoring into two layers:
Leading signals (available in near-real-time, no labels needed):
- Score distribution shift and decline rate, tracked with PSI (Population Stability Index) or KL divergence against a reference window
- Feature PSI on top model inputs
- Segment mix shifts in country, merchant category, and amount
- Step-up challenge failure rates as a fast-maturing fraud proxy
Lagging signals (on matured labels, weeks later):
- Precision, recall, and calibration curves by approval cohort
- Fraud rate in an approved-transaction audit sample
- Brier score trend by week
Prior shift vs. concept drift: If the fraud rate changes but P(features | fraud) stays stable, you have prior shift — re-estimate the class prior (e.g., using the EM method of Saerens et al.) and adjust the threshold accordingly without retraining. If recall degrades on matured labels while score distributions look stable, fraudsters have changed behavior — that calls for retraining the model itself, not just a threshold tweak.
Part 3: Segment Thresholds, Guardrails, and Experiments
Segment-level threshold tuning
For each segment (e.g., country × merchant category × amount bucket), set:
p*_s = C_FP,s / (C_FP,s + C_FN,s)
where C_FN,s ≈ transaction amount + chargeback fee + operations cost and C_FP,s ≈ lost margin + expected churn × LTV. High-ticket electronics warrants a lower threshold; a $5 coffee from a loyal customer warrants a higher one.
Practical constraints: enforce a minimum positive count before fitting a segment-specific threshold (sparse segments should inherit from a parent or use Bayesian shrinkage toward the global estimate). Hard constraints include card-network chargeback ratio limits — model these as budget constraints, not just soft objectives. Re-tune on a weekly or monthly cadence using matured labels, and apply changes only when the cost improvement is statistically significant. Version every threshold change for easy rollback.
Guardrail metrics
Primary metric: expected cost per 1,000 transactions on matured labels.
Guardrails to catch harmful side effects:
- Overall approval rate, and approval rate for high-LTV, long-tenure cardholders specifically
- Decline rate by country, MCC, merchant, and amount bucket — alert on any segment moving more than a pre-set relative threshold (e.g., 10%)
- Repeat-decline rate (same card declined twice within 24 hours)
- Card abandonment rate and switch-to-competing-payment rate
- Customer support contacts and fraud-dispute complaints per 10k transactions
- Chargeback ratio against network monitoring thresholds
- Step-up authentication completion rate
Experiment design
-
Offline replay. Re-score several weeks of fully matured traffic under the proposed thresholds and compute cost and all guardrails by segment. This is cheap and fast but subject to feedback loop bias (declined transactions never produce labels).
-
Shadow mode. Run the new thresholds in parallel, log their hypothetical decisions, and compare to production without acting on them. Manually audit cases where they disagree. This builds confidence before any customer impact.
-
Randomized A/B test. Randomize at the card or user level — not the transaction level — to avoid the same customer seeing inconsistent decisions within a session. Use stratified randomization by risk tier so both arms see similar fraud rates. Power the test on the primary cost metric, not just approval rate. Pre-register all guardrail thresholds before unblinding.
-
Staged rollout. Start with a low-traffic segment (one country or MCC), validate guardrails hold for at least one full chargeback maturation cycle, then expand. Maintain a kill switch to revert instantly if any guardrail is breached.
The hardest practical challenge is the survivorship bias in labels: your training and evaluation data contain no outcomes for blocked transactions. Acknowledge this openly and use the approved-transaction audit sample and step-up completion rates as the best available proxies.