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
November 29, 20260
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
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- 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 PrepSample 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 , i.e. . Scores are rarely perfectly calibrat...