Probability Theory
The grammar of uncertainty: what can happen, how likely each thing is, and how news reshapes every belief you hold.
Why Does This Exist?
Machine learning runs on uncertainty. Data is a sample, not the world. Labels are noisy. Models output beliefs, not certainties. Every one of those statements needs a language precise enough to compute with, and probability theory is that language: it assigns numbers to happenings, rules for combining them, and a principled way to update them when news arrives.
This page is the map, not the territory. It introduces the landscape once, names each region, and points to the dedicated page that teaches it. The rules of combining chances live in probability foundations. Counting the outcomes lives in counting and basic probability. Distributions, expectations, and limit laws each have their own pages below. Read this for orientation, then walk the streets.
The one idea you need first
A sample space is the set of everything that could happen, and an event is a subset you care about. Probability assigns each event a number between 0 and 1, with the whole space getting 1. Everything else is consequences of that assignment plus three rules: complements subtract from one, disjoint events add, and conditioning divides by what you learned.
Think of It Like This
Splitting a farmer's field by soil
A field is every possible outcome. Fence off the patches with good soil: the fenced fraction of the total area is the probability of good soil. Learn that a patch is near the river, and you stop asking about the whole field: the relevant fraction is now good soil within the riverside strip, which is conditioning.
New soil tests re-fence everything, the Bayesian update. And planting season after season samples the field rather than surveying all of it, which is why samples wobble around the truth. The picture carries the whole theory: spaces, events, conditioning, updating, sampling. It stops where counting starts, because real sample spaces need combinatorics, not fences.
How It Actually Works
The theory builds in layers, each resting on the last:
- Outcomes and events. The sample space lists everything possible; events carve out the interesting subsets. Finite spaces use counting, continuous ones use lengths, areas, and volumes.
- The rules. Complements, unions, and intersections combine events, and conditional probability re-normalizes onto what was learned. These three rules plus independence are taught in probability foundations.
- Random variables. Numbers attached to outcomes: the die shows 4, the latency reads 230 milliseconds. Variables come with distributions describing where their values land, covered in probability distributions.
- Expectations. Averages over the distribution: means, variances, and covariances that summarize behavior, taught in expectation, variance and covariance.
- Updating. Bayes' rule turns prior beliefs plus evidence into posterior beliefs, the engine of Bayes' theorem.
- Large samples. Averages settle near expectations and rescaled sums turn bell-shaped, the limit laws of the central limit theorem.
In plain words: name what can happen, weigh the happenings, attach numbers to them, average the numbers, update on news, and trust large samples. Every probabilistic argument in ML is some composition of those six moves.
Worked example
A bag holds 3 red and 7 blue balls. One draw: the sample space has 10 equally likely balls and the red event has 3, so .
Two draws without replacement: after one red leaves, 2 red remain among 9 balls, so the second draw is red with chance . Chaining along the tree in the diagram: . The second fraction differs from the first because the draws are dependent: the first outcome reshapes the second sample space, a preview of conditioning doing real work.
Watch Out For
Treating every multi-step chance as a chain of equal fractions
The second draw used , not , because the bag changed. Assuming independence where draws, users, or time steps interact is the most common probability error in applied work, and it always biases the same way: toward overstated confidence. Ask after every step whether the sample space moved before reusing a fraction.
Reading 0.067 as a verdict about one pair of draws
Probability describes the procedure across repetitions, not the fate of one run. Two reds either happened or did not; 0.067 says that across many bag-shakings, about one run in fifteen goes that way. Confusing the long-run rate with a property of a single outcome is how calibrated numbers get misread as predictions.
The Quick Version
- Probability theory assigns numbers between 0 and 1 to events carved from a sample space.
- Conditioning re-normalizes onto what was learned; the sample space moves with every observation.
- Random variables attach numbers to outcomes, distributions weigh them, expectations average them.
- Bayes updates beliefs on news; limit laws describe large samples settling down.
- Drawing twice from 3 red and 7 blue gives both red with chance 6 in 90, because the bag changes.