Skip to content

04 — Metrics: precision, recall, F1

flowchart LR
    THR["slide V threshold down"] --> REC["recall rises\nfewer missed V"]
    THR --> PRE["precision falls\nmore false alarms"]

Accuracy lies: with 90 N beats in 100, always guessing N scores 90% and catches zero dangerous beats. Grade per class instead, using four outcomes (V shown):

  • True positives: V beats correctly flagged V.
  • False negatives: V beats missed (called something else). The deadly error.
  • False positives: healthy beats falsely flagged V. Annoying but not deadly.
  • True negatives: healthy beats correctly left alone. The quiet majority.
Predicted V Predicted not-V
Real V true positives (caught) false negatives (missed — deadly)
Real not-V false positives (false alarms) true negatives
  • Recall (sensitivity): of all real V beats, how many did we catch? High recall means few missed dangerous beats. The safety metric — maximize it.
  • Precision: of all beats flagged V, how many truly were V? High precision means few false alarms.
  • F1: the balance of the two, one number per class.
  • Macro F1: the average of the five F1 scores. The headline number — the giant N class cannot hide F/Q failures.

The full 5x5 confusion matrix covers all classes at once. Template (counts arrive in Phase 5, results.md):

True \ Predicted N V S F Q
N correct false V alarm
V MISSED V (deadly) correct
S mistaken for N correct
F correct
Q correct

Reading rule: rows are truth, columns are model output. A row sums to that class real total (recall denominator); a column sums to that class flag total (precision denominator). Diagonal is correct; everything off it is a mix-up.

Rule of thumb: V recall is safety, macro F1 is headline, accuracy is decoration.

Next: 05-class-imbalance.md