City University of Hong Kong · FACULTY OF ARTIFICIAL INTELLIGENCE

BMS5010 Chap.5 Reading a Confusion Matrix Without Being Fooled

- one subject, every graph, every model, every mark
7 Chapters6-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 5 of 7 · BMS5010

Reading a Confusion Matrix Without Being Fooled

Four counts, and the four totals built from them

For a binary decision the course summarises performance in a two by two table, described as how well a model separates patients who have the condition from those who do not.

True positive, true negative, false positive and false negative are defined in terms of what happened to a person rather than in terms of arithmetic, and the four sums are written out explicitly: the patients who have the condition, the patients who do not, everyone the model called positive, and everyone it called negative. The first two totals are facts about the patients; the last two are facts about the model.

Every ratio in the topic divides by one of those four, and which one it divides by is the entire meaning of the ratio.

Row ratios describe the test

Sensitivity, also called recall or the true positive rate, is the chance that a patient with the condition receives a positive result. Specificity, the true negative rate, is the chance that a patient without it receives a negative one.

Both are computed inside a group defined by the patient rather than by the model, so moving the same test to a population where the condition is rarer leaves them unchanged. That stability is why manufacturers quote them and why they are the wrong numbers to give a patient.

They are also not independent: lowering the decision threshold raises sensitivity and lowers specificity, so either figure quoted alone is uninterpretable without the other at the same operating point.

Column ratios describe a result

Precision, the positive predictive value, is the share of flagged cases that were genuine.

The negative predictive value is the share of cleared cases that were genuinely clear, and the course notes that this is the figure that matters most in screening, where nearly every result is negative and the guarantee worth having is that a negative really is negative. Both divide by a total the model produced, so both move when the underlying prevalence changes even though nothing about the test has changed.

Confusing a row ratio with a column ratio is the most frequent error in clinical writing about model performance, and the fix is to name the denominator before saying the number.

Why the overall proportion correct is listed first and trusted last

Accuracy takes the whole table as its denominator, and the course states its limitation immediately: it can mislead on imbalanced datasets.

The mechanism is easy to state and easy to check. When one class is rare, a model that always answers with the common class scores close to perfect while identifying none of the cases anybody cares about. It has learned the base rate rather than the condition.

The check costs nothing: work out what the majority-class answer would have scored on your own test set, which is simply the share of that class, and see whether your model clearly beats it.

The balanced summary, and what it cannot tell you

The course gives one combined figure, a harmonic mean combining precision with recall, which stays low unless both are high and so cannot be inflated by pushing one to its ceiling.

It is useful when the two need balancing and it is not a substitute for reporting them: the harmonic mean of ninety and ten is about eighteen, which tells a reader something is badly wrong without saying which of the two it is. Report the pair, then the summary.

Which of the two matters more is decided by what the positive result triggers, and that is a clinical decision made before the model is evaluated rather than a reporting choice made after.

Sweeping the threshold instead of fixing it

Every ratio so far assumes a cut-off has already been chosen, but most models produce a score rather than a decision, so the cut-off is free and moving it trades the two error types.

The curve the course uses plots the true positive rate against the false positive rate, which is one minus specificity, as the cut-off sweeps its range, and the area beneath it summarises the sweep: one is perfect, one half is random, and below one half is worse than random.

One model has better discriminating power than another when its curve lies above the other at every level, and the qualifier matters, because two curves that cross describe models that each win in part of the range.

In this chapter

What this chapter covers

  • 01

    The four cells defined by what happened to a person

  • 02

    The four totals, and why the denominator is the meaning

  • 03

    Sensitivity and specificity as properties of the test

  • 04

    Precision and negative predictive value as properties of a result

  • 05

    The majority-class baseline that accuracy has to beat

  • 06

    The combined figure built from precision and recall, and its blind spot

  • 07

    The threshold sweep, the area beneath it, and crossing curves

Worked example · free

Tell a member of staff what their positive result means

Q [10 marks]. AskSia-authored practice. A hospital screens all 10,000 staff for a latent infection with a test that detects 95 per cent of carriers and clears 90 per cent of non-carriers. Two per cent of the workforce carries it. Build the table and say what a positive and a negative result are each worth. The marks shown are an AskSia study allocation and are not the University's marking scheme.
  • 2Convert the prevalence into counts of carriers and non-carriers.
  • 4Fill all four cells from the two published rates.
  • 4Compute both predictive values and name the figure that misleads here.
Two per cent of 10,000 gives 200 carriers and 9,800 non-carriers. Detecting 95 per cent of carriers gives 190 true positives and 10 false negatives. Clearing 90 per cent of non-carriers gives 8,820 true negatives and 980 false positives. A positive result therefore comes from 190 carriers and 980 healthy staff together, so it is correct about 16 per cent of the time. A negative result is correct 8,820 times out of 8,830, close to 100 per cent. The misleading figure is the overall proportion correct at about 90 per cent, because always answering negative would have scored 98 per cent while finding nobody. Sensitivity and specificity never changed; the prevalence did all the work.
Sia tip — Build the table in counts before computing any ratio. Ratios computed directly from percentages hide which denominator you used and that is where the error usually is.
Glossary

Key terms

False Negative
A negative prediction for a patient who has the condition, which leaves that patient missed and reassured at the same time.
False Positive
A positive prediction for a patient who does not have the condition, which triggers whatever follows a positive result for somebody who did not need it.
True Positive Rate
Another name for sensitivity and recall, being the share of patients with the condition that the model flags.
F1 Score
A single figure combining precision with recall through their harmonic mean, which stays low unless both are high and so resists being inflated by one of them alone.
Operating Point
The particular decision threshold at which a model's reported sensitivity and specificity were measured, without which neither figure is interpretable.
Area Under Curve
A summary of a model's performance across every decision threshold, where one is perfect discrimination, one half is chance and below one half is worse than chance.
FAQ

Reading a Confusion Matrix Without Being Fooled FAQ

Which single number should I put in the abstract of a report?

None, if you can avoid it, and if you cannot then the pair that matches the decision. An abstract quoting one figure invites the reader to assume it is the relevant one, and for a rare condition that assumption is usually wrong. The defensible short form names the operating point and gives two numbers: at a threshold flagging one patient in six, the model reached this precision and this recall.

That is barely longer than a single figure and it cannot be misread, which is the whole purpose of an abstract sentence.

Why does a model validated in a clinic disappoint in general practice?

Usually for arithmetic reasons rather than because the model degraded. A specialist clinic sees a much higher proportion of genuine cases than a general practice does, and every ratio dividing by a column total moves with that proportion. The same test with the same sensitivity and specificity therefore reports a much weaker positive predictive value in the wider setting.

This is why a report that quotes a predictive value without stating the prevalence of its own cohort has published a figure nobody can transfer anywhere.

How do I compare two models whose curves cross?

By deciding first which part of the range you will operate in, then reading the curves there. The area beneath each curve averages over every threshold including ones you will never use, so two crossing curves cannot be ranked honestly by their areas.

A screening programme with little tolerance for false alarms lives in the low false-positive region and should choose whichever curve is higher there, even if its overall area is slightly smaller. Say in the report where you operate and why, and the comparison becomes uncontroversial.

Study strategy

Assessment move

Draw the empty two by two table from memory, then write each of the five ratios next to the cells it divides by rather than as a formula. Do it twice, once naming the row denominators and once the column ones. After that, take any published performance figure you can find and say out loud which denominator it used before reading how the authors interpreted it.

Working through Reading a Confusion Matrix Without Being Fooled in BMS5010? Sia is AskSia’s AI Artificial Intelligence tutor — ask any BMS5010 Reading a Confusion Matrix Without Being Fooled question and get a clear, step-by-step explanation grounded in how BMS5010 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 6 of your City University of Hong Kong subjects - and 1,000+ Bibles across every Australian university.
Sia - your BMS5010 tutor, unlimited, worked the way the exam marks it
The full 6-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works
BMS5010 · Artificial Intelligence for Health Science Research and Management - independent study guide on the AskSia Library. More City University of Hong Kong subjects · Microeconomics across all universities