Statistics is the science of collecting, summarising and drawing conclusions from data. It is the foundation of data science and machine learning: every model, A/B test and dashboard relies on statistical ideas.
What You Will Learn
- Descriptive vs inferential statistics
- Population, sample, parameter and statistic
- Types of data
- Measures of centre and spread at a glance
- How statistics is used in ML
Prerequisites
Basic maths. Python examples use pandas.
Two Branches
| Branch | Question it answers | Examples |
|---|---|---|
| Descriptive | What does this data look like? | Mean, median, standard deviation, charts |
| Inferential | What can we conclude about the bigger population? | Confidence intervals, hypothesis tests, regression |
Key Terms
| Term | Example |
|---|---|
| Population | All Class 12 students in Punjab |
| Sample | 500 students we surveyed |
| Parameter | True average marks of all students (unknown) |
| Statistic | Average marks of our 500 students |
| Variable | Marks, gender, city… |
| Observation | One student’s record |
Types of Data
| Type | Subtype | Example | Typical summary |
|---|---|---|---|
| Categorical (qualitative) | Nominal (no order) | City, gender | Counts, mode |
| Ordinal (ordered) | Grade A/B/C, rating 1–5 | Median, mode | |
| Numerical (quantitative) | Discrete (counts) | Number of courses | Mean, median |
| Continuous (measured) | Height, income, time | Mean, std, histogram |
A Quick Example
import pandas as pd
marks = pd.Series([45, 52, 58, 61, 61, 67, 70, 74, 78, 95])
print(marks.describe().round(2))
count 10.00 mean 66.10 std 14.21 min 45.00 25% 58.75 50% 64.00 75% 73.00 max 95.00
Explanation: One line gives count, centre (mean, median = 50%), spread (std, quartiles) and range. Details in Descriptive Statistics.
Statistics in Machine Learning
| Statistical idea | Where it appears in ML |
|---|---|
| Mean and standard deviation | Feature scaling (StandardScaler) |
| Probability and Bayes | Naive Bayes, classifier probabilities, LLM token sampling |
| Distributions | Weight initialisation, anomaly detection |
| Correlation | Feature selection, PCA |
| Sampling | Train/test splits, cross-validation, bootstrapping |
| Hypothesis tests | A/B testing models in production |
Series
Maths & Statistics series: Introduction to Statistics · Descriptive Statistics · Probability · Bayes’ Theorem · Distributions · Inferential Statistics · Hypothesis Testing · P-Values · Correlation & Covariance · Linear Algebra · Eigenvalues · Calculus · Optimization · Interview Questions
Interview Questions
Q: Descriptive vs inferential statistics?
Descriptive summarises the data you have; inferential uses a sample to draw conclusions about a population.
Q: Nominal vs ordinal data?
Both are categories; ordinal categories have a natural order.
Practice Exercises
- Classify these variables: blood group, exam rank, temperature, number of siblings.
- Run describe() on a numeric column of any dataset and interpret each number.
Summary
Statistics describes data and lets us generalise from samples to populations. Knowing data types tells you which summaries and tests to use – the basis of every ML project.
Next: Descriptive Statistics
Machine Learning Tutorials, Courses and Certifications