A calibrated fraud model outputs . Missing a fraud costs ₹10,000 and flagging a legitimate transaction costs ₹1,000 in review effort. Derive the cost-minimising threshold. What would you do if the model were not calibrated?
ML systems and evaluation, Decision thresholds
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can turn error costs into a decision rule instead of defaulting to 0.5.
Key idea
Flag when the expected cost of flagging is lower than the expected cost of not flagging: , which gives .
Steps
- Write the expected cost of each action given , taking correct decisions to cost 0: not flagging costs ; flagging costs .
- Flag if and only if , that is, .
- Numbers: . Because a miss is ten times as costly, you flag even at a 9% fraud probability.
- If the model is not calibrated: either calibrate it first (Platt scaling or isotonic regression on held-out data), or sweep thresholds on a validation set and pick the one with the lowest total cost .
- Note a common practical limit: if the review team can only handle flags a day, the threshold is set by capacity (flag the top ), and precision@k becomes the metric that matters.
Common mistakes
- Using 0.5 by default; it is optimal only when the two error costs are equal.
- Putting the costs the wrong way round and getting .
- Plugging uncalibrated scores (raw SVM margins, an overconfident network) into the formula.
- Training on rebalanced data (oversampling fraud) and using the outputs as deployment probabilities without correcting for the changed class prior.
How long your answer should be
Three lines of derivation, one number, and two sentences on calibration; about 3 minutes.
Last checked on 4 December 2026.
Read this
Previous in ML systems and evaluation: Your current click-through rate is 10%. How many users per arm does an A/B test need to detect an absolute increase to 11%, with a two-sided significance level of 5% and 80% power?
Next in ML systems and evaluation: For true values and linear-regression predictions (fitted with feature), what are and adjusted , how can test-set become negative, and why does adding a pure-noise feature never reduce training whereas adjusted penalises it?