How do you determine the optimal classification decision given class posteriors and an asymmetric loss matrix?
Quick Overview
Asks how to turn class posterior probabilities and an asymmetric cost matrix into the decision with the lowest expected cost. It tests Bayes decision theory, deriving a cost-based threshold for binary classification, and the calibration and prior assumptions the rule depends on.
How do you determine the optimal classification decision given class posteriors and an asymmetric loss matrix?
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: medium
Interview Round: Other
How do you determine the optimal classification decision given class posteriors and an asymmetric loss matrix?
A model gives you $P(y \mid x)$ for each class, and the business gives you a loss matrix whose entry $L(a, y)$ is the cost of taking decision $a$ when the true class is $y$. Mistakes in different directions have different costs.
```hint Expected cost per decision
For a fixed input, each decision has a cost under each possible true class. Think about how the posterior turns those costs into one number per decision.
```
```hint Check the binary case
Write the comparison for two classes and solve for the posterior probability at which the two decisions cost the same.
```
### What a Strong Answer Covers
- The general decision rule written in terms of the loss matrix and the posteriors
- How the rule reduces to the familiar case under 0-1 loss
- The binary threshold derived from the four costs, with a numeric check
- What the posteriors must satisfy for the rule to be optimal in deployment
- Extensions such as a reject option or more actions than classes
### Follow-up Questions
- Your model was trained on balanced classes, but fraud is 1% of production traffic. How do you adjust the posteriors before applying the rule?
- How would you handle costs that vary per example, such as a fraud loss equal to the transaction amount?
- If the model's scores are not calibrated, how would you still pick a cost-optimal threshold?
- How would you choose the fixed cost of a reject option, and how would you check that it is set well?
Overview: Asks how to turn class posterior probabilities and an asymmetric cost matrix into the decision with the lowest expected cost. It tests Bayes decision theory, deriving a cost-based threshold for binary classification, and the calibration and prior assumptions the rule depends on.
How do you determine the optimal classification decision given class posteriors and an asymmetric loss matrix?
A model gives you P(y∣x) for each class, and the business gives you a loss matrix whose entry L(a,y) is the cost of taking decision a when the true class is y. Mistakes in different directions have different costs.
What a Strong Answer Covers Guidance
The general decision rule written in terms of the loss matrix and the posteriors
How the rule reduces to the familiar case under 0-1 loss
The binary threshold derived from the four costs, with a numeric check
What the posteriors must satisfy for the rule to be optimal in deployment
Extensions such as a reject option or more actions than classes
Follow-up Questions Guidance
Your model was trained on balanced classes, but fraud is 1% of production traffic. How do you adjust the posteriors before applying the rule?
How would you handle costs that vary per example, such as a fraud loss equal to the transaction amount?
If the model's scores are not calibrated, how would you still pick a cost-optimal threshold?
How would you choose the fixed cost of a reject option, and how would you check that it is set well?