Machine learning models are, underneath, statistical models. A classifier outputs a probability, its loss function is a negative log-likelihood, its regularizer is a prior, its evaluation is a hypothesis test in disguise, and the data it learns from is a sample from a population nobody fully observes. If you understand the probability and statistics underneath, you can debug models, read papers and design experiments instead of copying recipes.
This article collects 101 concepts in the order they build on each other: probability foundations, expectation and variance, the distributions that keep reappearing, limit theorems and sampling, estimation, statistical inference, information theory, regression, evaluation metrics and finally the probabilistic machinery behind modern models. Each entry gives a definition, the key formula, where it shows up in data science or machine learning, and a short example. All numerical results were recomputed with Python (NumPy and SciPy). Numbers in examples are illustrative unless a source is cited.
If you would rather see probability applied to everyday situations such as medical tests, polls and quality control, read the companion article 100 probability and statistics examples for real-world applications. This article focuses on the concepts and their role in data work.
Probability foundations
1. Sample space and events
The sample space is the set of all possible outcomes; an event is a subset of it.
In data science: defining the sample space precisely ("one user session", "one transaction") is the first step in any analysis, and many bugs come from mixing units.
Example: For two coin flips, and "at least one head" is , with probability .
2. Axioms of probability
Everything else, including and , follows from these three rules (Kolmogorov, 1933).
Example: If 30% of users use mobile, 50% use desktop and 10% use both, then , so 70% use at least one.
3. Conditional probability
In data science: every segment-level metric ("conversion rate among mobile users") is a conditional probability.
Example: If 10% of all users are mobile users who convert and 40% are mobile users, then .
4. Independence
and are independent when , equivalently .
In data science: the assumption that training examples are independent and identically distributed (i.i.d.) underlies most learning theory. Time series, repeated users and grouped data break it.
Example: Two fair dice: .
5. Law of total probability
If partition :
Example: If 60% of traffic is mobile converting at 2% and 40% is desktop converting at 5%, the overall rate is . A shift in traffic mix changes the overall rate even if neither segment changes.
6. Bayes' theorem
The posterior is the likelihood times the prior, normalized.
Example: 20% of emails are spam. The word "free" appears in 50% of spam and 5% of other mail. Then
7. Naive Bayes classifier
Assume features are conditionally independent given the class:
In data science: a fast, strong baseline for text classification. The independence assumption is usually false, but the ranking of classes is often still right.
Example: Extending concept 6, an email containing both "free" and "winner" multiplies the two likelihood ratios. Work in log space to avoid underflow when there are thousands of words.
8. Counting: permutations and combinations
Example: There are pairs of features among 20, which is why exhaustive interaction search grows quickly.
9. Random variables
A random variable maps outcomes to numbers. It is discrete if it takes countably many values and continuous if it has a density.
Example: "Number of clicks in a session" is discrete; "time on page" is continuous.
10. PMF, PDF and CDF
A probability mass function gives ; a density gives probabilities as areas, ; the cumulative distribution function is .
In data science: a density value can exceed 1 (it is not a probability). An empirical CDF is often a clearer plot than a histogram because it needs no bin width.
Example: For a uniform density on , everywhere in the interval, yet the total area is 1.
Expectation and variance
11. Expected value
Example: A promotion costs $2 per user and returns $50 with probability 5%. The expected profit per user is .
12. Linearity of expectation
This holds even when and are dependent.
Example: The expected number of users who click, among 1,000 with click probabilities , is , whatever the correlations between users.
13. Variance
Example: A fair die has and , so .
14. Standard deviation and scaling
is in the same units as . .
In data science: standardizing features, , puts them on comparable scales for gradient-based training and distance-based methods such as k-nearest neighbors.
15. Covariance
Example: For and , the sample covariance is : positive, so they tend to rise together.
16. Correlation
Example: The data in concept 15 has . Correlation measures linear association only: on symmetric data has despite a perfect relationship. And correlation alone does not establish causation.
17. Covariance matrix
For a random vector , . It is symmetric and positive semidefinite.
In data science: principal component analysis takes the eigenvectors of ; the Mahalanobis distance detects outliers that account for correlation.
Example: The data in concept 15 has .
18. Law of total expectation
Example: If average order value is $40 for new customers (30% of orders) and $60 for returning customers, the overall average is .
19. Law of total variance
Total variance splits into variance within groups plus variance between group means.
In data science: this decomposition is the idea behind ANOVA, and behind variance-reduction methods such as stratified sampling and CUPED in A/B testing.
20. Jensen's inequality
For a convex function : . For concave : .
In machine learning: it proves that KL divergence is never negative (concept 69) and gives the evidence lower bound used in variational inference (concept 95).
Example: For equal to 1 or 9 with equal probability, .
Probability distributions
21. Bernoulli distribution
One trial with success probability : , .
In machine learning: the output of a binary classifier is the parameter of a Bernoulli distribution, and binary cross-entropy is its negative log-likelihood.
22. Binomial distribution
The number of successes in independent Bernoulli trials:
Example: With a 20% click rate, the chance that exactly 3 of 10 users click is .
23. Geometric distribution
The number of trials until the first success: , .
Example: If 10% of leads convert, a salesperson expects to contact 10 leads per sale.
24. Poisson distribution
Counts of rare events in a fixed interval at rate :
Example: A server averages 3 errors per hour. and . If observed counts have variance much larger than the mean (overdispersion), use a negative binomial model instead.
25. Uniform distribution
On : density , mean , variance .
In machine learning: random search for hyperparameters often samples uniformly on a log scale, such as a learning rate between and .
26. Exponential distribution
Waiting time between Poisson events: , mean . It is memoryless: .
Example: If support tickets arrive on average every 10 minutes, the chance of waiting more than 5 minutes is , no matter how long you have already waited.
27. Normal distribution
About 68.3%, 95.4% and 99.7% of the probability lies within 1, 2 and 3 standard deviations of the mean.
28. Standard normal and z-scores
has mean 0 and standard deviation 1, so one table (or scipy.stats.norm) serves every normal distribution.
Example: A model's latency is normal with mean 120 ms and SD 15 ms. A 150 ms request has ; only about 2.3% of requests are slower.
29. Multivariate normal distribution
In machine learning: Gaussian mixture models, Gaussian processes, Kalman filters and linear discriminant analysis are all built on it. Its marginals and conditionals are again normal.
30. Log-normal distribution
is log-normal if is normal. It is right-skewed and positive.
In data science: incomes, file sizes, session lengths and response times are often roughly log-normal. Model , and report medians, which are more stable than means.
31. Beta distribution
A distribution on with density proportional to and mean .
In machine learning: the natural prior for a probability, such as a click-through rate. Thompson sampling for multi-armed bandits draws from a Beta posterior for each arm.
32. Gamma distribution
Positive and right-skewed, with shape and scale : mean , variance . The exponential and chi-square distributions are special cases.
In machine learning: the conjugate prior for a Poisson rate or a normal precision.
33. Categorical and multinomial distributions
The categorical distribution picks one of classes with probabilities ; the multinomial counts outcomes over such draws.
In machine learning: a softmax output layer (concept 76) parameterizes a categorical distribution; a language model's next-token prediction is one.
34. Dirichlet distribution
A distribution over probability vectors with ; the multivariate version of the Beta.
In machine learning: latent Dirichlet allocation (LDA) uses it for topic proportions in documents.
35. Student's t distribution
The distribution of for normal data. It has heavier tails than the normal and approaches it as degrees of freedom grow.
Example: With 15 degrees of freedom the two-sided 95% critical value is 2.131, against 1.960 for the normal. Small samples need wider intervals.
36. Chi-square distribution
The sum of squared independent standard normals. It describes sample variances and the test statistics in goodness-of-fit and independence tests (concept 60).
Limit theorems and sampling
37. Law of large numbers
The sample mean converges to as .
In data science: why averages over more data are more reliable, and why a small A/B test can show a large "effect" that disappears with more traffic.
38. Central limit theorem
For i.i.d. data with finite variance, approaches a standard normal distribution as grows, whatever the shape of the original distribution.
In data science: it justifies normal-based confidence intervals and tests for means and proportions, even for skewed metrics such as revenue, provided samples are large enough. Very heavy tails need much larger samples.
39. Standard error
Example: With and , . To halve the standard error you need four times as much data.
40. Bootstrap
Estimate the sampling distribution of any statistic by resampling the data with replacement many times and recomputing the statistic.
In data science: confidence intervals for medians, ratios, AUC and other metrics with no simple formula. It assumes the sample represents the population and needs care with dependent data, such as several sessions per user (resample users, not sessions).
41. Monte Carlo estimation
Approximate an expectation by averaging random draws: . The error shrinks like .
Example: Estimating as 4 times the fraction of random points in the unit square that fall inside the quarter circle: with points the standard error is about 0.0016.
42. Markov and Chebyshev inequalities
Example: For any distribution with finite variance, at most 25% of values lie more than 2 standard deviations from the mean. The normal distribution gives 4.6%; Chebyshev is the worst case.
43. Hoeffding's inequality
For the mean of independent values bounded in :
In machine learning: the basis of many generalization bounds and of sample-size guarantees.
Example: To estimate an accuracy within with 95% confidence, test examples suffice for any model.
44. Sampling bias
A sample is biased when the selection process makes some units more likely to be included in a way related to the outcome. More data does not fix it.
In data science: survivorship bias (analyzing only customers who stayed), selection bias (training a credit model only on approved applicants) and non-response bias all produce models that fail on the real population.
Estimation
45. Estimators and bias
An estimator is a function of the data. Its bias is .
Example: The sample variance with divisor is biased low by a factor ; dividing by (Bessel's correction) removes the bias.
46. Mean squared error and the bias–variance decomposition
In machine learning: a slightly biased estimator with much lower variance often wins. Regularization (concept 77) and shrinkage deliberately add bias to cut variance.
47. Maximum likelihood estimation
Choose the parameters that make the observed data most probable:
In machine learning: minimizing cross-entropy or mean squared error is maximum likelihood under a Bernoulli/categorical or Gaussian noise model.
48. MLE examples
For Bernoulli data, . For normal data, and (the biased version from concept 45).
Example: 7 conversions out of 10 trials give .
49. Maximum a posteriori (MAP) estimation
The prior acts as a penalty term; with a flat prior, MAP equals MLE.
50. Conjugate priors: Beta–binomial
With a prior and successes in trials, the posterior is .
Example: A uniform prior and 7 conversions in 10 trials give , with posterior mean . That is pulled slightly toward 0.5 compared with the MLE of 0.7, which protects against over-reading 10 data points.
51. Credible intervals
A 95% credible interval contains the parameter with 95% posterior probability.
Example: For the posterior above, the central 95% credible interval is about : ten trials say very little.
52. Fisher information and the Cramér–Rao bound
, and any unbiased estimator from i.i.d. observations has .
Example: For Bernoulli data , so no unbiased estimator beats variance . The sample proportion achieves it.
53. Method of moments
Set sample moments equal to theoretical moments and solve for the parameters.
Example: For a uniform distribution on , , so . It is simple, but here the MLE () has much lower mean squared error.
54. Consistency
An estimator is consistent if it converges to the true value as .
In machine learning: an estimator can be consistent yet badly biased in small samples, and a model trained on biased data (concept 44) can converge confidently to the wrong answer.
Statistical inference and experiments
55. Confidence intervals
A 95% confidence interval comes from a procedure that captures the true parameter in 95% of repeated samples. It is not a 95% probability statement about one computed interval.
Example: 520 of 1,000 surveyed users prefer a design: .
56. Hypothesis testing
State a null hypothesis (no effect) and an alternative, compute a test statistic, and reject if data this extreme would be unlikely under it.
In data science: the logic behind A/B tests, feature-significance checks and drift detection.
57. p-values
The probability, assuming is true, of a result at least as extreme as the one observed. It is not the probability that is true, and it says nothing about the size of the effect.
Example: A sample of 16 with mean 52 and SD 8, tested against : with 15 degrees of freedom gives a two-sided . The data are consistent with no difference.
58. Type I and type II errors, and power
A type I error rejects a true (rate ); a type II error misses a real effect (rate ). Power, , is the chance of detecting an effect of a given size.
In data science: underpowered experiments miss real improvements, and the ones that do reach significance tend to overstate the effect.
59. t-tests
Compare a mean with a value (one-sample), two group means (Welch's two-sample test, which does not assume equal variances), or paired measurements.
Example: Comparing a model's error on the same 50 test sets before and after a change calls for a paired test, which removes the variation between test sets.
60. Chi-square test of independence
Example: For the table (variant by converted or not), each expected count is 25, so with 1 degree of freedom, giving .
61. A/B testing
Randomly assign units to control and treatment, fix the sample size and metric in advance, then compare. Randomization is what lets you read a difference as caused by the change.
In data science: check for sample-ratio mismatch (unequal group sizes signal a bug), and do not stop the moment ; repeated peeking inflates false positives unless you use a sequential testing method.
62. Sample size calculation
For comparing two proportions and with significance and power :
Example: Detecting a lift from 10% to 12% with and 80% power needs about 3,840 users per group. Halving the detectable lift roughly quadruples the sample.
63. Multiple comparisons
Run 20 independent tests at with no real effects, and the chance of at least one false positive is .
Fixes: the Bonferroni correction tests each at (here 0.0025); the Benjamini–Hochberg procedure controls the false discovery rate and keeps more power when many hypotheses are tested.
64. Permutation tests
Shuffle the group labels many times and recompute the statistic to build its null distribution directly. They need no distributional assumptions beyond exchangeability under .
Example: To test whether a feature's importance score is meaningful, permute that feature's values and see how often a score as high appears by chance.
65. Effect size
A standardized magnitude, independent of sample size. Cohen's .
In data science: with millions of users, trivially small effects become "significant". Always report the effect with a confidence interval, not just a p-value.
66. Bayesian A/B testing
Model each variant's rate with a posterior (concept 50) and report and the expected loss of choosing each.
Example: With and the same for B, draw 100,000 samples from each and count how often B's draw is larger. The answer is directly interpretable, but it still depends on the prior and still suffers if you stop early on noise.
Information theory
67. Entropy
The average surprise, in bits.
Example: A fair coin has 1 bit of entropy; a coin with has about 0.469 bits. Decision trees choose splits that reduce entropy the most (information gain).
68. Cross-entropy
In machine learning: the standard classification loss. For one example whose true class gets predicted probability , the loss is : 0.223 when but 2.303 when . Confident mistakes are punished heavily.
69. KL divergence
It is zero only when , and it is not symmetric.
Example: From a fair coin to a model with : nats. KL appears in variational autoencoders, knowledge distillation and the penalty that keeps a fine-tuned language model close to its reference model.
70. Mutual information
The reduction in uncertainty about from knowing . Unlike correlation, it detects nonlinear dependence.
In data science: feature selection (mutual_info_classif in scikit-learn) and contrastive representation learning.
71. Log loss is negative log-likelihood
Minimizing average cross-entropy over a dataset is exactly maximizing the likelihood of the labels under the model (concept 47). This is why "cross-entropy loss" and "negative log-likelihood loss" are the same thing in most libraries.
72. Perplexity
Example: A language model with average cross-entropy 2.0 nats per token has perplexity : on average it is as uncertain as a uniform choice among about 7.4 tokens.
Regression and modeling
73. Linear regression as maximum likelihood
If with , maximizing the likelihood is the same as minimizing the sum of squared errors, giving .
Example: See the worked fit in 101 linear algebra problems with solutions, problem 95.
74. Coefficient of determination (R²)
The share of variance explained. It never falls when you add features, so compare models on held-out data or with adjusted .
75. Logistic regression
Each coefficient changes the log-odds linearly.
Example: A coefficient of 0.693 doubles the odds per unit increase in that feature, because .
76. Softmax
Example: Scores become probabilities . Subtracting the largest score before exponentiating gives the same result without overflow.
77. Regularization as a prior
L2 regularization (ridge) is MAP estimation with a Gaussian prior on the weights; L1 (lasso) corresponds to a Laplace prior, which pushes some weights exactly to zero.
In machine learning: weight decay in neural networks is the L2 version; the regularization strength plays the role of the prior's precision.
78. Bias–variance tradeoff
Expected test error = bias² + variance + irreducible noise. Simple models underfit (high bias); flexible models overfit (high variance).
79. Cross-validation
Split data into folds, train on , validate on the remaining one, and average. It estimates generalization error and guides model choice.
In data science: split by group (user, patient) or by time when examples are related, or the estimate will be optimistic. Any preprocessing fitted on the data, such as scaling or imputation, must be fitted inside each fold to avoid leakage.
80. Overfitting and data leakage
Overfitting is learning noise in the training data. Leakage is letting information unavailable at prediction time into training, such as a "days since cancellation" feature in a churn model. Leakage produces excellent validation scores and a model that fails in production.
81. Generalized linear models
A GLM links a linear predictor to the mean of a distribution from the exponential family: identity link with normal errors (linear regression), logit link with Bernoulli (logistic), log link with Poisson (count regression).
Example: Model website visits per day with Poisson regression so predictions stay positive and variance grows with the mean.
82. Residual diagnostics
Plot residuals against fitted values and check for patterns, changing spread (heteroscedasticity) and outliers.
In data science: a funnel-shaped residual plot means standard errors from ordinary least squares are wrong; use robust standard errors or transform the target.
Evaluating classifiers and predictions
83. Confusion matrix
Counts of true positives (TP), false positives (FP), false negatives (FN) and true negatives (TN) at a chosen threshold.
Example: TP = 80, FP = 20, FN = 40, TN = 860. Accuracy is , which sounds good but hides that a third of positives are missed.
84. Precision and recall
Example: For concept 83, precision is and recall is .
85. F1 score
Example: . The harmonic mean punishes imbalance between the two. Use when recall matters times as much as precision.
86. ROC curve and AUC
The ROC curve plots true positive rate against false positive rate across all thresholds. The area under it (AUC) is the probability that a random positive scores higher than a random negative.
87. Precision–recall curves for imbalanced data
When positives are rare, ROC curves can look good while precision is poor, because the false positive rate divides by a huge number of negatives. Precision–recall curves and average precision show the trade-off that matters for rare-event detection such as fraud.
88. The base-rate fallacy
A test that is 95% sensitive and 95% specific, applied where only 1% have the condition, gives a positive predictive value of
In machine learning: a fraud model's alerts are mostly false alarms when fraud is rare, even if the model is accurate. This is Bayes' theorem (concept 6) again.
89. Calibration and the Brier score
A model is calibrated if, among predictions of 70%, about 70% are positive. The Brier score rewards both calibration and sharpness.
In data science: boosted trees and deep networks are often miscalibrated; Platt scaling and isotonic regression fix this after training. Calibration matters whenever probabilities feed decisions, such as expected cost.
90. Choosing a decision threshold
The best threshold depends on costs, not on 0.5. If a false negative costs 10 times a false positive and probabilities are calibrated, predict positive when .
91. MAE versus RMSE
Example: Errors give MAE = 2 but RMSE = ; RMSE weights the one large error heavily. Minimizing MAE targets the conditional median; minimizing squared error targets the mean.
92. Quantiles and prediction intervals
Instead of a single prediction, estimate quantiles (with pinball loss) to give a range, such as a 10th–90th percentile delivery time.
In data science: conformal prediction wraps any model to produce intervals with a guaranteed coverage rate on exchangeable data.
Probabilistic machinery in modern machine learning
93. Markov chains
A process where the next state depends only on the current one. A well-behaved chain converges to a stationary distribution with .
Example: Google's original PageRank is the stationary distribution of a random surfer on the web graph.
94. Markov chain Monte Carlo
Build a Markov chain whose stationary distribution is the posterior you want, then sample from it. The Metropolis–Hastings rule accepts a proposed move from to with probability , which only needs the posterior up to a constant.
In data science: probabilistic programming tools such as Stan and PyMC use advanced versions (Hamiltonian Monte Carlo, NUTS).
95. Variational inference and the ELBO
Approximate an intractable posterior with a simpler by maximizing the evidence lower bound:
Since the KL term is non-negative, the ELBO is a lower bound on .
In machine learning: variational autoencoders and scalable Bayesian models train by maximizing it.
96. The reparameterization trick
Write with , so a random sample becomes a differentiable function of and and gradients can flow through it. This is what makes variational autoencoders trainable by backpropagation.
97. Expectation–maximization and Gaussian mixtures
For models with hidden variables, alternate an E-step (compute each point's probability of belonging to each component) and an M-step (refit parameters with those weights). Each iteration never decreases the likelihood.
Example: Fitting a two-component Gaussian mixture to customer spending finds a "casual" and a "power user" cluster with soft memberships, unlike k-means' hard assignments.
98. Kernel density estimation
A smooth, non-parametric density estimate. The bandwidth matters far more than the kernel shape; Silverman's rule of thumb is for roughly normal data.
99. Gaussian processes
A distribution over functions in which any finite set of values is multivariate normal, defined by a mean and a kernel such as .
In machine learning: Gaussian processes give predictions with uncertainty from small data and power Bayesian optimization for hyperparameter tuning.
100. Simpson's paradox
A trend in every subgroup can reverse when the groups are combined, because the groups differ in size and composition.
In data science: always check whether an aggregate comparison is confounded by mix (device, region, user tenure). The companion article works through the 1973 Berkeley admissions data as an example.
101. Correlation, causation and confounding
A confounder affects both the treatment and the outcome, creating association without causation. Randomized experiments break confounding; without them, methods such as matching, instrumental variables, difference-in-differences and causal graphs try to recover causal effects under stated assumptions.
Example: Users who use a feature churn less, but engaged users are both more likely to find the feature and less likely to churn. Only an experiment, or a credible causal design, tells you whether promoting the feature would reduce churn.
Common mistakes
- Reading a p-value as the probability the null is true (concept 57), or treating "not significant" as "no effect".
- Ignoring base rates: high accuracy on rare events can still mean most alerts are false (concept 88).
- Reporting accuracy on imbalanced data instead of precision, recall and PR curves (concepts 84–87).
- Peeking at an A/B test and stopping when it looks good, and testing many metrics without correction (concepts 61 and 63).
- Leaking information through preprocessing fitted on all the data, or random splits of grouped or time-ordered data (concepts 79 and 80).
- Assuming independence when the same users, sessions or time periods appear many times (concept 4).
- Confusing correlation with causation (concept 101).
Next steps
- Work through 100 applied problems in probability and statistics examples for real-world applications.
- See how loss functions are minimized in 100 mathematical optimization techniques used in AI, engineering and research.
- Review the linear algebra behind covariance matrices and PCA in 101 linear algebra concepts for machine learning.
- Brush up on integrals and series in 100 calculus formulas, theorems and examples, and browse the mathematics category.
References
- All of Statistics: A Concise Course in Statistical Inference, Larry Wasserman, Springer (2004).
- An Introduction to Statistical Learning, Gareth James, Daniela Witten, Trevor Hastie, Robert Tibshirani and Jonathan Taylor, Springer (2nd edition, 2021; Python edition, 2023). https://www.statlearning.com/
- Pattern Recognition and Machine Learning, Christopher M. Bishop, Springer (2006). https://www.microsoft.com/en-us/research/people/cmbishop/prml-book/
- Deep Learning, Ian Goodfellow, Yoshua Bengio and Aaron Courville, MIT Press (2016), chapter 3, "Probability and Information Theory". https://www.deeplearningbook.org/contents/prob.html
- Introductory Statistics 2e, Barbara Illowsky and Susan Dean, OpenStax (2023). https://openstax.org/details/books/introductory-statistics-2e
- NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/
- Benjamini, Y. and Hochberg, Y. (1995). "Controlling the false discovery rate: a practical and powerful approach to multiple testing." Journal of the Royal Statistical Society, Series B, 57(1), 289–300. https://doi.org/10.1111/j.2517-6161.1995.tb02031.x
- Kingma, D. P. and Welling, M. (2013). "Auto-Encoding Variational Bayes." arXiv:1312.6114. https://arxiv.org/abs/1312.6114
- Kohavi, R., Tang, D. and Xu, Y. (2020). Trustworthy Online Controlled Experiments: A Practical Guide to A/B Testing. Cambridge University Press.