KatInterview

Choose the Right Metric for an Imbalanced Fraud Detector

Machine LearningModel answer
MediumModel answerMachine Learningmachine learningevaluation metricsimbalanced classification

Last updated

Decide which evaluation metrics best capture a fraud detection model's real-world performance when only 0.3% of transactions are fraudulent.

Background

You are a machine learning engineer at a payments company. Your team has just trained a binary classifier to flag potentially fraudulent transactions before they are settled. The dataset has the following properties:

  • Training set: 10 million transactions, of which ~30,000 are confirmed fraud (0.3% positive rate).
  • Business context: A missed fraud (false negative) costs the company roughly $200 on average. Flagging a legitimate transaction (false positive) triggers a manual review that costs $5 and annoys the customer.
  • Operational constraint: The review team can handle at most 2,000 flagged transactions per day.

A colleague proposes evaluating the model with accuracy because "it's the most intuitive metric." Another colleague argues for AUC-ROC alone.

What you are expected to do

  1. Explain why accuracy is a poor choice here and quantify the problem.
  2. Explain the limitation of AUC-ROC in this context.
  3. Identify two or three metrics that are actually appropriate, explaining what each captures and why it fits the business constraints.
  4. Describe how you would use a precision-recall curve to pick the operating threshold, given the cost asymmetry and the capacity constraint.
  5. Mention at least one common mistake practitioners make when evaluating models on imbalanced data.

Hints

Hint 1

What accuracy score would a model that predicts 'not fraud' for every transaction achieve? Is that useful?

Hint 2

Think about what the review team capacity constraint implies for the maximum acceptable false-positive rate at your chosen threshold.

Hint 3

AUC-ROC averages performance over all thresholds and all class ratios — what does that hide when the positive class is rare?