Learning objectives
- Compute a confusion matrix for a rare event.
- Explain why high overall accuracy can hide a useless detection rule.
Prerequisites: Understand true and false positives and a fixed event-labeling horizon.
Mechanism and interpretation
When an event is rare, predicting that it never occurs can achieve high accuracy. Precision=TP/(TP+FP) asks what fraction of alerts are correct. Recall=TP/(TP+FN) asks what fraction of actual events are detected. Specificity=TN/(TN+FP) measures correct rejection of non-events. These ratios use different denominators and answer different operational questions.
A research design must define the positive event and horizon before scoring. For a drawdown alert, overlapping windows can label many days from one episode, so counts may not represent independent opportunities. Threshold choice changes the balance between false alarms and missed events. Evaluate costs and capacity constraints rather than choosing a threshold solely for a flattering headline accuracy.
Worked case · synthetic data
In 1,000 synthetic days,20 contain the defined event. A model raises 60 alerts,12 correct. ThenTP=12, FP=48, FN=8, TN=932. Accuracy=(12+932)/1,000=94.4%, precision=12/60=20%, recall=12/20=60%. A never-alert baseline has 98% accuracy but zero recall. Neither accuracy figure alone describes whether alerts are economically useful.
Failure modes and context
Precision changes when event prevalence changes even if conditional detection rates are stable. A false alert may be cheap or expensive depending on the action it triggers. Treating every day as independent can overstate confidence. If there are no predicted positives, precision needs a declared undefined-value policy rather than an invented perfect score.
Practice assignment
Among 500 opportunities,25 are true events. A rule produces 40 alerts,15 correct. ComputeTP, FP, FN, TN, precision, recall and accuracy. Compare accuracy with a never-alert baseline and explain why the comparison is incomplete.
Worked answer
TP=15, FP=25, FN=10, TN=450. Precision=37.5%, recall=60%, accuracy=465/500=93%. Never-alert accuracy=475/500=95%, with zero recall. Which rule is useful depends on benefits of correct alerts, costs of false alarms and the feasibility of acting, not accuracy alone.
Check your understanding
Question 1
Which denominator defines precision?
- All predicted positives
- All actual positives
- All observations
Reveal answer and reasoning
A. All predicted positives
Precision measures the reliability of issued alerts.
Question 2
What is recall for 15 detected events out of 25?
- 37.5%
- 93%
- 60%
Reveal answer and reasoning
C. 60%
Recall divides true positives by all actual positives.
Question 3
Why can never-alert accuracy be high?
- False negatives are impossible
- Most observations may be non-events
- The model understands every event
Reveal answer and reasoning
B. Most observations may be non-events
Class imbalance rewards majority predictions in the overall accuracy metric.
