# Fraud Detection Interviews: Stop Using ROC-AUC as Your Main Metric

<p align="center"><img src="https://bugfree-s3.s3.amazonaws.com/mermaid_diagrams/image_1768976804635.png" alt="Fraud detection" style="max-width:800px;width:100%;height:auto;"/></p>

## Stop handing ROC-AUC as the answer in fraud-detection interviews

In real-time fraud detection your data is heavily imbalanced: fraud is rare, legitimate transactions are common. That imbalance makes ROC-AUC a trap in interviews — it can look “good” even when your model misses most fraud.

### Why ROC-AUC misleads

- ROC-AUC measures ranking quality using true positive rate vs false positive rate. When negatives dominate, small absolute changes in false positives barely move the false positive *rate*, so a model can score high AUC while still producing too many missed frauds or too many false alarms in absolute terms.
- ROC-AUC is threshold-independent and symmetric between classes. Fraud detection is not symmetric: the positive class (fraud) is what you must catch.

### Lead with Precision/Recall and AUC-PR

- Precision/Recall focuses on the positive class. AUC-PR (area under the precision-recall curve) better reflects performance when positives are rare.
- Precision answers: “If I block or flag this transaction, how likely is it truly fraud?”
- Recall answers: “Of all frauds, how many did I catch?”

In interviews, state that you'll evaluate models with precision, recall, PR curve and AUC-PR. Mention complementary metrics like precision@k or lift if the business reviews only the top-scoring transactions.

### Decision rule: pick a threshold based on business loss — not 0.5

Scores from a model are probabilities or relative ranks. The operational question is a business decision: what cutoff triggers a block, challenge, or manual review?

Choose the threshold that minimizes expected business loss:

Expected loss per transaction = (Cost_FN * FN_rate) + (Cost_FP * FP_rate)

- Cost_FN = expected cost of a missed fraud (chargeback, reimbursement, fraud spread, reputational loss)
- Cost_FP = expected cost of a false alarm (customer friction, lost conversion, manual review cost)

Tune the threshold on a validation set (temporal split) to minimize this expected loss. If chargebacks are expensive, tune for higher recall. If customer experience or conversion is critical, tune for higher precision.

Example (illustrative):
- Chargeback cost = $200 (Cost_FN)
- Manual review cost = $10 (Cost_FP)
- If threshold A yields FN_rate=0.001 and FP_rate=0.01 → Expected loss = 200*0.001 + 10*0.01 = 0.2 + 0.1 = $0.30 per tx
- If threshold B is more conservative with FN_rate=0.0005 and FP_rate=0.02 → Loss = 200*0.0005 + 10*0.02 = 0.1 + 0.2 = $0.30 per tx
Both thresholds have the same expected loss; pick the one that aligns with operational constraints (review capacity, UX tolerance).

### Practical interview talking points

- State your preferred metrics up front: precision, recall, PR curve, AUC-PR, precision@k, and business loss.
- Explain how you’ll choose thresholds using a cost-based objective and show a simple expected-cost calculation.
- Show calibration and score distributions; a well-calibrated score makes thresholding more interpretable.
- Use time-based validation (train on past, validate on future) and sample the rare positives correctly.
- Present confusion matrix and precision/recall at the chosen threshold — numbers matter in interviews.

### Additional tips and alternatives

- If you only have capacity to investigate the top N alerts, use precision@N or lift.
- For continuous decisions (e.g., dynamic review policies), consider optimizing for expected utility across segments.
- When communicating to product/stakeholders, translate model metrics into business KPIs: chargebacks avoided, review cost, or conversion impact.

In short: in fraud settings, lead with precision/recall and AUC-PR, then pick a threshold from a business-loss perspective. That shows you understand both the ML and the real-world trade-offs.

#MachineLearning #DataScience #MLOps
