Understanding Prediction Outcomes
Binary Classification Outcomes
For binary classification (K=2), every prediction falls into one of five categories:
| Outcome | Condition | Meaning | Action |
|---|---|---|---|
| SC | Singleton, correct | Confident AND right | Safe to automate |
| SI | Singleton, incorrect | Confident BUT wrong | Failure mode |
| TS0 | Two-set, true=0 | Uncertain, actual was 0 | Manual review |
| TS1 | Two-set, true=1 | Uncertain, actual was 1 | Manual review |
| Empty | Empty set | No class passed threshold | Edge case |
Multiclass Classification Outcomes
For multiclass classification (K>2), outcomes generalize naturally:
| Outcome | Condition | Meaning | Action |
|---|---|---|---|
| SC | |S|=1, y ∈ S | Confident AND right | Safe to automate |
| SI | |S|=1, y ∉ S | Confident BUT wrong | Failure mode |
| MC | |S|>1, y ∈ S | Uncertain, true label covered | Manual review |
| MU | |S|>1, y ∉ S | Uncertain, true label NOT covered | Coverage failure |
| Empty | |S|=0 | No class passed threshold | Edge case |
Relationship to binary outcomes: In binary classification, MC is equivalent to TS0 ∪ TS1 (both are multi-sets that contain the true label, since |S|=2=K means all classes are included). MU is impossible in binary because a two-set always covers both classes.
Using Outcomes
from conformalpy.outcomes import (
categorize_outcomes,
outcome_summary,
outcome_proportions,
)
# Categorize each prediction
outcomes = categorize_outcomes(prediction_sets, y_test)
# Returns: ['SC', 'TS1', 'SI', 'SC', ...]
# Get summary statistics
summary = outcome_summary(prediction_sets, y_test)
print(f"Coverage: {summary['coverage']:.1%}")
print(f"Confidence rate: {summary['confidence_rate']:.1%}")Singleton Confusion Matrix
For singleton (confident) predictions, analyze the confusion matrix:
from conformalpy.outcomes import singleton_confusion_matrix
cm = singleton_confusion_matrix(prediction_sets, y_test)
# Returns TN, FP, FN, TP for singleton predictions onlyThis shows: among the predictions you would automate, how many are correct?
See the outcome distribution example for visualizing outcome distributions.