What are probability and probability distributions?
Probability measures how likely an event is, on a scale from 0 (impossible) to 1 (certain). A probability distribution assigns probabilities to every possible outcome of a random variable. For a discrete variable, such as a coin flip, it gives a probability for each outcome. For a continuous variable, such as a height, it gives a density curve, and probabilities are areas under that curve.
Machine learning is built on these ideas. Training data is treated as samples from an unknown distribution, classifiers output a distribution over classes, and the most common loss functions are negative log-probabilities.
Key ideas
- Probabilities run from 0 to 1, and the probabilities of all outcomes sum to 1.
- For continuous variables, probability is area under a density curve.
- μ sets where the normal distribution sits; σ sets how wide it is.
- P(B|A) and P(A|B) are different quantities; Bayes' theorem converts one into the other.
- Expected value is a probability-weighted average, and it is linear.
- Sample averages approach the true mean as n grows, with error shrinking like 1/√n.
Common questions
What is a random variable?
A random variable assigns a number to each outcome of a random process. For a coin flip, X might be 1 for heads and 0 for tails. Working with numbers instead of outcomes is what lets you compute averages, variances, and distributions.
What is the difference between probability and likelihood?
Probability fixes the model's parameters and asks how likely different outcomes are. Likelihood fixes the observed data and asks how well different parameter values explain it. Likelihood is not a distribution over parameters and does not have to sum to 1. Maximum likelihood estimation picks the parameters that make the observed data most likely.
Why do ML models work with log-probabilities?
The probability of a whole dataset is a product of many small numbers, which quickly underflows to zero on a computer. Taking logs turns the product into a sum, and because log is increasing, the parameters that maximize the log-likelihood also maximize the likelihood. Cross-entropy loss is the negative log-probability of the correct answer.
Which distributions show up most in machine learning?
Bernoulli and categorical distributions describe classification outputs. The normal distribution models regression noise, weight initialization, and the latent space of VAEs. Uniform distributions are used for initialization and random sampling, and the Poisson distribution models counts.
Related explainers
- Bayes' Theorem — Updating beliefs with evidence
- Statistics Essentials — Mean, variance, standard deviation, and the Central Limit Theorem
- Entropy & Cross-Entropy — Measuring surprise, uncertainty, and prediction quality
- MLE & MAP Estimation — Maximum likelihood and maximum a posteriori — why training works
- Sampling & Monte Carlo — Random sampling, the law of large numbers, and Monte Carlo estimation
- KL Divergence — Measuring how different two distributions are
References
- Blitzstein & Hwang, "Introduction to Probability" (free online edition)
- Goodfellow, Bengio & Courville (2016), "Deep Learning", chapter 3: Probability and Information Theory
- Bishop (2006), "Pattern Recognition and Machine Learning", chapters 1–2
Last updated