When should you address unequal error costs by modifying the loss function versus tuning the decision threshold?

Quick Overview

Asks when unequal false positive and false negative costs should be handled by changing the training loss and when by moving the decision threshold. Tests decision theory, calibration, class weighting, multi-class cost matrices and asymmetric regression losses.

When should you address unequal error costs by modifying the loss function versus tuning the decision threshold?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

When should you address unequal error costs by modifying the loss function versus tuning the decision threshold? A false negative and a false positive cost different amounts. You can build the costs into training (class weights, a cost-sensitive loss) or train normally and apply the costs when turning scores into decisions. ```hint Start from expected cost Write the expected cost of predicting positive and of predicting negative for a point whose probability of being positive is $p$. Ask what that comparison needs from the model, and when the model can supply it. ``` ```hint When cutting scores is not enough Think about cases where the model's scores in the expensive region are poor wherever you cut, and cases where the output is not a single score that can be cut. ``` ### What a Strong Answer Covers - The condition under which a threshold chosen after training is enough, and how the cost-optimal threshold follows from the two error costs. - The practical benefits of keeping costs out of training: changing costs, several consumers of one model, and usable probabilities. - The situations where changing the loss changes what the model learns in a way no threshold can reproduce. - Problems that have no single threshold to move, such as multi-class cost matrices and asymmetric regression penalties. - A concrete default workflow, and the risk of applying both corrections at once. ### Follow-up Questions - You train a logistic regression with weight w on the positive class. How do its predicted probabilities relate to the unweighted ones, and which threshold should you use afterwards? - The costs are unknown, but the team can review only a fixed number of cases per day. How do you set the threshold? - With calibrated multi-class probabilities and a full cost matrix, how do you make the decision without retraining? - Is oversampling the minority class equivalent to reweighting the loss?

Overview: Asks when unequal false positive and false negative costs should be handled by changing the training loss and when by moving the decision threshold. Tests decision theory, calibration, class weighting, multi-class cost matrices and asymmetric regression losses.

Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

When should you address unequal error costs by modifying the loss function versus tuning the decision threshold?

A false negative and a false positive cost different amounts. You can build the costs into training (class weights, a cost-sensitive loss) or train normally and apply the costs when turning scores into decisions.

What a Strong Answer Covers Guidance

  • The condition under which a threshold chosen after training is enough, and how the cost-optimal threshold follows from the two error costs.
  • The practical benefits of keeping costs out of training: changing costs, several consumers of one model, and usable probabilities.
  • The situations where changing the loss changes what the model learns in a way no threshold can reproduce.
  • Problems that have no single threshold to move, such as multi-class cost matrices and asymmetric regression penalties.
  • A concrete default workflow, and the risk of applying both corrections at once.

Follow-up Questions Guidance

  • You train a logistic regression with weight w on the positive class. How do its predicted probabilities relate to the unweighted ones, and which threshold should you use afterwards?
  • The costs are unknown, but the team can review only a fixed number of cases per day. How do you set the threshold?
  • With calibrated multi-class probabilities and a full cost matrix, how do you make the decision without retraining?
  • Is oversampling the minority class equivalent to reweighting the loss?