How can a classifier detect that an input belongs to an unknown class rather than forcing it into a learned class?
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: hard
Interview Round: Other
A classifier is trained on a fixed set of classes, but once deployed it will also see inputs from classes that were never in its training data. How can a classifier detect that an input belongs to an unknown class rather than forcing it into a learned class?
```hint Look past the argmax
Softmax probabilities always sum to 1 over the known classes. Ask what that rules out, and what quantity could say that an input fits none of them.
```
```hint Think in feature space
Consider where a novel input's learned representation lands relative to the training examples of each class.
```
```hint Plan the threshold
You will need a rejection threshold without examples of every possible unknown. Ask which data you can set it on and what you would measure.
```
### What a Strong Answer Covers
- Why a standard softmax classifier cannot say "none of the above" on its own.
- Scores computed from the outputs (confidence, entropy, energy) and from feature space (distance or density).
- Model and training changes that make rejection easier, such as one-vs-rest heads, OpenMax, outlier exposure or a background class.
- How the rejection threshold is set and how the detector is evaluated.
- The limits, including inputs from new classes that look close to known ones.
### Follow-up Questions
- Two inputs have logits [10, 8, 8] and [2, 0, 0]. What do the max softmax probability and the energy score say about each?
- Why might a Mahalanobis score catch a corrupted image that max softmax accepts, and when can it fail?
- Your outlier exposure data is generic web images, but the unknowns in production are new product categories close to the known ones. What goes wrong, and what would you change?
- How would you choose the threshold if rejecting a known input costs much less than accepting an unknown one?
Overview: Asks how a trained classifier can flag inputs from classes it never saw during training. Tests knowledge of open-set and out-of-distribution detection scores, the model and training changes that help, how to set a rejection threshold, and how to evaluate the detector.