Pick a Decision Threshold for Return Abuse Flags Under Asymmetric Costs

Last updated: November 29, 2026

Quick Overview

A model scores each return request for abuse risk. Given scores, labels, the cost of wrongly blocking a good customer and the cost of missing an abusive return, choose the threshold that minimizes expected cost and write the code to find it.

Amazon
Machine Learning
Data Scientist
Amazon
November 29, 2026
Data Scientist
Onsite
Machine Learning
Medium

0

0

0 solved


A model scores each return request for abuse risk. Given scores, labels, the cost of wrongly blocking a good customer and the cost of missing an abusive return, choose the threshold that minimizes expected cost and write the code to find it.

Amazon data science loops often ask candidates to turn a classifier into a business decision. Here the interviewer wants to see that you reason in dollars and customer trust, not accuracy, and that you can implement an exact threshold sweep.

What the Interviewer Expects
  • Frames the problem as expected cost, not accuracy or F1
  • Assigns realistic costs including customer trust for false positives
  • Implements an O(n log n) sweep that handles tied scores
  • Handles the option of flagging nobody
  • Discusses validating the threshold on held-out data and monitoring drift
Key Topics to Cover
cost-sensitive classification
thresholding
confusion matrix
expected cost
calibration
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • What if the cost of a false negative varies with the item price?
  • How would you set the threshold if review capacity is capped at 2,000 cases per day?
  • How does class prior shift between training and production change the optimal threshold?
  • When would you prefer a three-way decision: approve, send to human review, block?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Confirm what a positive action means (block the refund, or route to investigation), the unit costs, and whether scores are calibrated probabilities. Suppose wrongly flagging a good customer costs $5 ...

Approach

If scores are calibrated, the Bayes-optimal rule flags when p⋅CFN>(1−p)⋅CFPp \cdot C_{FN} > (1 - p) \cdot C_{FP}, i.e. p>CFPCFP+CFN=5/45≈0.11p > \frac{C_{FP}}{C_{FP} + C_{FN}} = 5/45 \approx 0.11. Scores are rarely perfectly calibrat...


Submit Your Answer
Markdown supported