Skip to content
GenAI Learn/The Math You Actually Need
Browsing as a guest. Sign in to save your progress and earn XP as you complete chapters.

Probability & Uncertainty for ML

6 min read

You'll learn to

  • -Understand why ML models output probabilities rather than certainties
  • -Interpret a model's confidence score correctly
  • -Apply Bayes' theorem to update a belief given new evidence

Machine learning models almost never output a flat yes or no. They output probabilities, degrees of confidence, and it is up to the surrounding system to decide what to do with that number. Get comfortable with this idea now, because it shapes everything else in this course.

A Prediction Is a Distribution, Not a Fact

When a spam classifier says an email is 92% likely to be spam, it is not stating a fact. It is reporting a degree of belief based on patterns in its training data. That remaining 8% chance of being wrong is not a bug. It is an honest reflection of genuine uncertainty. A model that always claimed 100% or 0% confidence would usually be lying about how sure it actually is.

Thresholds Turn Probability Into Decisions

Somewhere in the system, a threshold decides what probability counts as "spam enough" to act on: move to a spam folder at 90% confidence, flag for review between 50% and 90%, deliver normally below that. Choosing that threshold is an engineering and product decision, not something the model decides for you, and it directly trades off false positives against false negatives.

Two Ways to Be Wrong
Model flags something that was actually fine (e.g. real email marked spam)
False positive
Model misses something it should have caught (e.g. real spam delivered)
False negative

Bayes' Theorem: Updating Belief With Evidence

The single most interview relevant piece of probability in ML is Bayes' theorem: a formula for updating a prior belief once new evidence arrives. It is the mathematical backbone of spam filters, medical test interpretation, and, conceptually, how a model's confidence should shift as it sees more signal.

Bayes' Theorem
P(A|B) = [P(B|A) · P(A)] / P(B)
The probability of A given that B happened, expressed in terms of how likely B is if A is true, how likely A was before seeing any evidence (the "prior"), and how likely B is overall.

Here is a genuinely counterintuitive example. A medical test is 99% accurate for a disease that only 1 in 10,000 people actually have. You test positive. How worried should you be? Intuition says very, but Bayes' theorem disagrees, because the disease is so rare that false positives from the healthy 9,999 vastly outnumber true positives from the one person who is actually sick.

Bayes' theorem: why a 99% accurate test on a rare disease is misleading

A model that is confidently wrong is far more dangerous than one that is honestly uncertain. Watch for cases where a model's stated confidence does not match its actual accuracy. That mismatch is called calibration, and a poorly calibrated model can be worse than no model at all in high-stakes settings.

Interview Signal is part of Pro

See a real weak answer next to a real strong one for this exact topic.

Quiz is part of Pro

Test what you just read with a short quiz, and bank the XP.

ScaleDojo Logo
Initializing ScaleDojo