Statistics and probability for data science and machine learning: what to learn, in order
The statistics and probability data science and machine learning use, in 7 steps, with a worked example for each and a list of what you can skip.
The statistics and probability you need for data science and machine learning come down to seven topics, learned in order: describing data, reading evidence critically, probability, distributions, estimation with uncertainty, hypothesis testing, and the information theory behind classification losses. That is less than a statistics degree teaches, but each topic builds on the last. You can learn the first four before your first model and the rest alongside it.
Statistics is how data science turns a table into a decision you can defend: summarizing what the data shows, judging whether a pattern is real, and saying how sure you are. Here is what each step covers, why it matters in real data work, a worked example you can read now, and the lessons in the free Statistics track that teach it.
The short answer
| Step | Topic | You can do this afterwards |
|---|---|---|
| 1 | Describing data | Summarize any column and pick the right chart for it |
| 2 | Evidence and EDA | Tell a real pattern from a misleading one before modeling |
| 3 | Probability | Reason about rare events, classifiers and conditional evidence |
| 4 | Distributions | Recognize the shape of data and what a model assumes about it |
| 5 | Estimation | Put an honest interval around any number, including a model score |
| 6 | Hypothesis testing | Decide whether a difference or an A/B result is more than noise |
| 7 | Information theory | Understand log loss, cross-entropy and how trees choose splits |
Statistics for data science vs statistics for machine learning
Both use steps 1 to 5. The difference is emphasis:
| Data science and analytics lean on | Machine learning leans on | |
|---|---|---|
| The usual question | Is this difference real, and what caused it? | How well will this model do on data it has not seen? |
| Core tools | Sampling, confidence intervals, hypothesis tests, A/B tests | Probability, likelihood, distributions, cross-entropy |
| Typical output | An estimate or decision with an interval around it | A model, plus an honest estimate of its error |
| Where it goes wrong | A pattern that is noise, bias or confounding (steps 2 and 6) | A score that is noise or leakage, or a loss nobody can interpret (5 and 7) |
If you are heading for machine learning, do not skip steps 5 and 6: every model comparison is a small hypothesis test, whether or not anyone calls it one.
1. Describing data
Every analysis starts by summarizing what is there. You need a typical value, a measure of spread and a picture of the shape:
- Mean, median and mode, and why one outlier can pull the mean far from the typical case.
- Variance, standard deviation and IQR.
- Histograms and density, percentiles and quantiles, and box and violin plots for comparing groups.
- Correlation, confounding and causation and correlation heatmaps for relationships between columns.
In a model this is feature inspection: spotting skew, outliers, impossible values and features that duplicate each other.
Worked example: choose the right chart for a dataset. For a one-page summary of which measure and plot answers which question, keep the free descriptive statistics cheat sheet open while you work.
2. Evidence and exploratory data analysis
The most expensive statistical mistakes come from trusting a pattern that the data cannot support. This step is about reading evidence critically: how charts can mislead, missing denominators and base rates, Simpson's paradox and survivorship bias. The post on misleading statistics walks through seven of these with examples.
It also treats EDA as a sequence of decisions, not a pile of charts, ending in a one-page data report for a model.
3. Probability
Classifiers output probabilities, and most of the reasoning around them is conditional probability. The probability module of the Statistics track covers this step. Learn probability basics, conditional probability and independence and Bayes' theorem, which explains why a 99% accurate test for a rare condition is wrong most of the times it says yes. Then expected value and variance, which is how you compare two decision rules with different costs, and Monte Carlo simulation, which answers probability questions in code when the algebra is hard.
Worked example: conditional probability with a table, which calculates the same evidence in both directions and connects it to Bayes' rule.
4. Distributions
A distribution is the shape of the process that produced your data. The ones that matter most in practice:
- Bernoulli and binomial, for yes-or-no outcomes like clicks and conversions.
- The normal distribution, z-scores and the 68-95-99.7 rule.
- Long tails and log transforms, for prices, incomes and durations.
- Dependence over time, which explains why a random train-test split leaks the future in time series data.
You will also use the Q-Q plot to check whether a model's residuals look the way it assumes.
Worked example: Bernoulli vs binomial, the two distributions behind every yes-or-no outcome.
5. Estimation and uncertainty
Every number computed from a sample, including a model's accuracy on a test set, is an estimate. This step is about how much it could move:
- Sampling distributions and the central limit theorem.
- Confidence intervals, and what they do not mean.
- The bootstrap, which gives an interval for almost any statistic by resampling.
- Maximum likelihood estimation, which turns out to be where logistic regression's loss function comes from.
Worked example: a model gets 120 of 150 test rows right. How sure is that 80%? The bootstrap answers in a few lines of NumPy, by resampling the 150 results with replacement and recomputing the accuracy each time:
import numpy as np
rng = np.random.default_rng(42)
correct = np.array([1] * 120 + [0] * 30) # 120 of 150 test predictions right
resampled = [rng.choice(correct, size=correct.size).mean() for _ in range(10_000)]
low, high = np.percentile(resampled, [2.5, 97.5])
print(f"accuracy {correct.mean():.2f}, 95% interval {low:.2f} to {high:.2f}")
accuracy 0.80, 95% interval 0.73 to 0.86
The resampled accuracies approximate this score's sampling distribution, and the middle 95% of them runs from about 73% to 86%. A second model scoring 82% on a test set this size has not shown that it is better; to compare two models fairly, score them on the same rows and look at the cases where they disagree. Bootstrap confidence intervals works through a smaller case resample by resample, and the estimation module teaches this step in full.
6. Hypothesis testing
Testing answers one question: could this difference be noise? Learn hypothesis testing and the p-value through a simulation first, then permutation tests, the t-test and the chi-square test, and how tests go wrong through multiple comparisons and repeated looks. The step ends with designing and reading an A/B test for a deployed model, which is one of the most common statistics tasks in industry.
Worked example: p-values explained with an exact coin-test calculation.
7. Information theory for machine learning
Classification models are trained by minimizing cross-entropy, also called log loss. Decision trees choose splits by entropy or Gini impurity. Model monitoring compares distributions with KL divergence, and feature selection can use mutual information. These are short lessons once probability is in place, and they make the loss functions you meet in machine learning readable rather than magic.
Worked example: entropy, cross-entropy and KL divergence calculated on the same distribution.
Where regression fits
Linear regression sits where statistics and machine learning meet. Statistics reads it as a model to interpret, with residuals to check (the Q-Q plot from step 4) and coefficients with intervals (step 5). Machine learning reads it as the first model trained by minimizing a loss. The Machine Learning track teaches it in linear regression and gradient descent, and the statistics above is what makes its output readable.
What you can skip for now
For applied data science and classical machine learning you can skip, at first: measure-theoretic probability, proofs of the central limit theorem, most named distributions beyond the ones above, ANOVA tables, and hand calculation from statistical tables. Software computes all of these. What it cannot do is tell you which comparison is fair, whether a sample represents the population, or whether a difference matters, and that judgment is what the steps above build.
Do you need all of it before your first model?
No. Steps 1 to 4 are enough to start your first models, and you can learn them alongside Python. Steps 5 to 7 are easier to learn while you are already training models, because each one answers a question you will have just met: how sure am I of this score, is this improvement real, and what is this loss function measuring.
For where statistics sits among the other prerequisites, see prerequisites for machine learning. For the full learning order across Python, data tools, maths and statistics, see where to start with machine learning.
Is probability or statistics more important for machine learning?
You need both, for different jobs. Probability describes uncertainty inside a model: its predicted probabilities, its loss function and how it updates on evidence. Statistics describes uncertainty about the model: how far a score measured on a sample can be trusted, and whether an improvement is real. Steps 3, 4 and 7 are mostly probability; steps 1, 2, 5 and 6 are mostly statistics.
Your next step
Start the Statistics track at the first module, why statistics matters. Lesson parts and key terms are free to read. A free account adds the quizzes and saves your progress, with no payment. If you are learning machine learning seriously, the learner community below is where course access for selected learners is shared.