Machine Learning Foundations

Course Content

Machine Learning Foundations

14 sections · 70 lessons

What are true positives, false positives, true negatives, and false negatives?


What you need to know

First fix the positive class. "Positive" does not mean good. It means "the thing the model is trying to detect". In fraud detection, fraud is positive. In medical screening, having the disease is positive.

How to decode the names

Each name has two parts:

  • The second word (positive / negative) is what the model predicted.
  • The first word (true / false) says whether that prediction was right.

So a false positive is "predicted positive, and that was false" — the case was actually negative. A false negative is "predicted negative, and that was false" — the case was actually positive.

NameModel saidRealityEveryday name
True Positive (TP)PositivePositiveCorrect catch
True Negative (TN)NegativeNegativeCorrect all-clear
False Positive (FP)PositiveNegativeFalse alarm (Type I error)
False Negative (FN)NegativePositiveMiss (Type II error)

Rates built from them

Two related terms come up in medical and ROC questions:

Text
sensitivity (= recall, true positive rate) = TP / (TP + FN)   share of sick people caughtspecificity (true negative rate)          = TN / (TN + FP)   share of healthy people clearedfalse positive rate                        = FP / (FP + TN)   = 1 - specificity

Sensitivity is about the actual positives; specificity is about the actual negatives. A test can be excellent at one and poor at the other.

Why the cost of each error differs

The four outcomes are not equally important. A false positive and a false negative usually have very different costs, and the whole field of threshold tuning is about trading one for the other. That is why you must know them precisely: the rest of this section — precision, recall, F1 — is just ratios of these four counts.

A real-life example

A tuberculosis screening camp tests 2,000 people with a quick chest-X-ray model. 50 people actually have TB.

Model: TBModel: no TB
Has TB (50)TP = 46FN = 4
No TB (1,950)FP = 120TN = 1,830
  • 46 true positives go for a confirmatory sputum test and start treatment.
  • 4 false negatives go home believing they are healthy. They stay untreated and may infect others. This is the costly error.
  • 120 false positives get a free confirmatory test that comes back negative. It costs some money and worry, but no lasting harm.
  • 1,830 true negatives are correctly cleared.

Sensitivity is 46 / 50 = 92%; specificity is 1,830 / 1,950 ≈ 94%. For a screening camp, the team would accept even more false positives to cut the 4 misses, because every positive gets a second, more accurate test anyway.

Follow-up questions to expect

  • "Which is worse, a false positive or a false negative?" — It depends on the domain. In cancer screening, false negatives are worse; in a spam filter that might hide an invoice, false positives are worse. Always tie the answer to the cost.
  • "What are Type I and Type II errors?" — Terms from statistics: Type I is a false positive (rejecting a true null hypothesis), Type II is a false negative (missing a real effect).
  • "If you swap which class is positive, what changes?" — TP and TN swap, FP and FN swap, and so precision and recall change meaning. Accuracy stays the same.