Choosing and Defending Metrics for a Rare-Class Abuse Detector
Machine LearningModel answerLast updated
Pick, justify, and stress-test evaluation metrics for an imbalanced fake-account classifier, wiring thresholds to asymmetric action costs and biased labels.
Context
Your team ships a classifier that scores each account with a probability of being fraudulent. Product and leadership want to know how you will judge whether it "works well," both before launch and after.
Your task
- Recommend which evaluation metrics you would use to assess this classifier and say why, given that fraud is rare.
- Contrast precision, recall, F1, ROC-AUC, and PR-AUC — what each one does and does not tell you here.
- Explain how false positives and false negatives map to business costs, and how you turn those costs into a decision threshold.
- Describe the traps that arise when measuring in production (class prevalence, label bias, adversaries, drift) and how you would keep the evaluation trustworthy.
- Close with the handful of metrics you would put in front of leadership.
Assume a heavy class imbalance, multiple possible actions (hard block, step-up verification, manual review queue, silent downranking), and whose cost is non-symmetric.
Hints
Hint 1
Accuracy and ROC-AUC both look great under heavy imbalance — say explicitly why, and what you report instead.
Hint 2
Write down the expected cost of acting versus not acting on an account, and derive the threshold from the cost ratio.
Hint 3
Evaluate recall only on labels you can trust-unbiased: random human-reviewed samples, not the accounts your own model flagged.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
What is being tested
Three competencies: whether you know that accuracy and ROC-AUC mislead at low prevalence; whether you can translate business costs into a calibrated threshold and an operating point; and whether you can show the model holds up in production where labels are biased, late, and shaped by the model's own decisions.
1. Frame the costs first, the metric second
State prevalence up front. Say fake accounts are ~2% of accounts: of 100M accounts, 2M fake and 98M genuine. Then name the two errors and what each costs.
A false positive — flagging a real person — triggers a challenge, a lockout, or a ban. Costs: churn, lost engagement and ad revenue, support volume, appeals, and reputational or regulatory exposure. The cost is highest for long-tenured and high-value users.
A false negative — missing a fake — lets spam, scams, harassment, fake engagement, and ad fraud persist. The harm is diffuse, spread across many other users and advertiser trust.
Crucially, the cost ratio depends on which action the score triggers. A wrongful permanent ban is enormously more expensive than a wrongful phone-verification challenge. So "which metric" is really "which action tier."
2. The metrics and their trade-offs
From the confusion matrix:
- Precision = TP / (TP + FP): among accounts we act on, what fraction are truly fake? This is the user-protection metric.
- Recall (TPR) = TP / (TP + FN): among all fakes, what fraction do we catch? This is the platform-protection metric.
- FPR = FP / (FP + TN): the fraction of genuine users we inconvenience.
- F1 = harmonic mean of precision and recall. It bakes in the assumption that both errors cost the same — usually false here. Prefer F-β (β > 1 leans toward recall) only if you insist on a single scalar, and prefer explicit costs even more.
- ROC-AUC is threshold-free and measures ranking quality (how well fakes outscore genuines). It is prevalence-insensitive because FPR is divided by the huge genuine pool, so a "great" ROC curve can hide a terrible working point.
- PR-AUC / average precision focuses entirely on the positive class and therefore surfaces what ROC hides under imbalance.
Worked example. At TPR = 90% and FPR = 1% on our 100M accounts: TP = 1.8M, FP = 0.98M, so precision ≈ 1.8 / 2.78 ≈ 65%. One in three flagged accounts is a real person — nearly a million wrongly actioned users — yet the ROC curve looks stellar. The PR curve exposes this. Note also that precision depends on prevalence: it must be computed at the production class ratio, never on a balanced training set.
And accuracy: a model that always predicts "genuine" scores 98% and catches nothing. Mention it in one sentence and move on.
3. Threshold from expected cost
If scores are calibrated (score ≈ probability the account is fake), acting on an account with probability p has expected cost (1 − p)·C_FP; not acting has expected cost p·C_FN. Act when:
p > C_FP / (C_FP + C_FN)
If wrongly banning a real user costs 20× a missed fake, flag only above p ≈ 20/21 ≈ 0.95. Verify calibration with a reliability diagram or Brier score and recalibrate (Platt scaling, isotonic regression) before trusting the rule. Then use tiered operating points: auto-block at precision ≥ 99%; step-up challenge at a medium threshold (cheap FPs justify higher recall); human review sized by capacity, scored as precision@k where k is daily reviewer throughput; silent downranking at a low threshold.
The headline metric is then "recall at precision ≥ X for action tier T," plus total expected cost — language leadership can act on.
4. Trustworthy labels
Enforcement data is selection-biased: you only learn ground truth for accounts you flagged or users reported, so recall measured there is inflated. Fixes: human-review a random or stratified sample of all accounts (oversample high scores, reweight back to population prevalence) to get unbiased precision, recall, and prevalence at every threshold; keep a small holdout where the model takes no action to measure counterfactual harm and break the feedback loop; evaluate at a fixed label-maturity window because some fakes only reveal themselves weeks later; track inter-rater agreement among reviewers.
5. Production evidence and monitoring
Pair offline numbers with online outcomes: estimated fake prevalence (from random samples) as the health metric; FP proxies (appeal rate and appeal overturn rate, support tickets, churn among challenged users, challenge pass rate); FN proxies (spam/scam reports, downstream fraud loss, time-to-detection); an A/B or holdout comparison. Segment by country, language, tenure, and device — concentrated false positives are both a fairness and business risk. Since adversaries adapt, track score distributions, feature drift, and precision at a fixed threshold weekly, alerting on decay.
Final recommendation
| Purpose | Metric |
|---|---|
| Model comparison | PR-AUC (average precision) primary; ROC-AUC secondary |
| Operating point | Calibrated scores + cost-based threshold, per action tier |
| Per-tier reporting | Recall at a precision floor; precision@k for review capacity |
| Production proof | Sampled fake prevalence, appeal overturn rate, report volume, A/B vs. holdout |
| Ongoing health | Segment breakdowns, drift and alarm monitoring |
Use F1 only as a convenience summary when costs really are comparable — they usually are not.
Common mistakes: reporting accuracy or ROC-AUC alone at 2% prevalence; defaulting to F1 or a 0.5 threshold with no cost justification; computing precision on a rebalanced test set; measuring recall only on flagged or reported accounts; ignoring calibration before applying a cost rule; and forgetting that label delays and adversarial drift make last month's numbers stale.