Discrete and Continuous Probabilities
Probability and Distributions
Random variables come in two flavors. A discrete random variable takes values in a finite or countable set (like \{1, 2, 3, 4, 5, 6\} or mathbb{N}) and is described by a probability mass function (PMF): p(x) = P(X = x). Mass functions satisfy p(x) geq 0 and sum_x p(x) = 1 — probability is distribute
Discrete distributions use PMFs (probabilities at points); continuous use PDFs (probabilities per unit).
No discrete/continuous distinction → no principled loss design, no calibrated uncertainty, no log-likelihoods.
Random variables come in two flavors. A discrete random variable takes values in a finite or countable set (like or ) and is described by a probability mass function (PMF): . Mass functions satisfy and — probability is distributed across discrete points.
A continuous random variable takes values in an uncountable set like , and is described by a probability density function (PDF) with and . The probability of any single point is zero; meaningful probabilities come from intervals: .
Densities are *not* probabilities — they can be greater than 1 (a narrow tall density integrates to 1 over a small region). This surprises people. The right mental picture: a density is a rate, probability-per-unit-of-, and what matters is the area under it over an interval. Units matter too: if is in meters, has units of 1/meter.
Both types share a cumulative distribution function (CDF): . For discrete variables, the CDF is a staircase; for continuous, it's a smooth increasing function. The CDF is universally useful because it always exists, always returns true probabilities, and maps cleanly to quantile-based computations (sampling via inverse CDF, confidence intervals).
ML mixes both constantly. Classification outputs a discrete distribution over labels via softmax. Regression predicts a continuous given . Tokens in a language model are discrete but attention scores are continuous. Mastery of both paradigms — and especially how to think about *mixed* or *structured* distributions like those in energy-based models — is essential for building and debugging modern probabilistic systems.
Worked example — PMF of Binomial(3, 0.5): For , gives , , , . Total: . These are exactly the probabilities of 0, 1, 2, 3 heads in three fair flips.
ML connection — softmax as a PMF: Given logits , softmax outputs giving roughly , summing to and all non-negative. This is precisely a PMF over three discrete classes — the reason softmax is the canonical classification output.
Exercises
Put your understanding to the test. Score + streak + speed all count.
Confirm you've got it
3 quick questions. Get 2 right to mark this lesson complete.