Intermediate · module I3 · Sublevel Beginner
Mathematics for AI
By the end: Calculate and interpret the key statistics, probabilities, vector operations and slopes that machine learning relies on
- Covers
- The statistics, probability, linear algebra and calculus ideas behind AI, each explained in words before any formula
- Contents
- 4 chapters, 20 topics
- Time
- About 4 hours
- Level
- Intermediate
- Your progress
- 0 / 20
This module builds on Python Programming for AI. We suggest looking at it first, but the choice is yours.
Chapter 1 Statistics
- 1.110 min Read
Mean, Median and Mode
Measures of the centre, and when each misleads
Code: compare the measures on skewed data
x̄ = Σxᵢ / n
- 1.210 min Read
Variance and Standard Deviation
How spread out values are
Code: compare two classes with the same mean
σ² = Σ(xᵢ − x̄)² / n
- 1.38 min Read Activity
Percentiles, Quartiles and Outliers
Box plots and the 1.5 × IQR rule
Code: find outliers in salaries
IQR = Q3 − Q1
- 1.410 min Read
Correlation
Measuring how two variables move together, and why correlation is not causation
Code: correlation heatmap
r = cov(X,Y) / (σₓσᵧ)
- 1.512 min Read Activity
Sampling and Hypothesis Testing
Samples, confidence intervals, p-values and A/B tests
Code: test whether a new study method helps
t = (x̄ − μ₀) / (s / √n)
Chapter 2 Probability
- 2.110 min Read
Probability Basics
Events, outcomes and simple probability
Code: simulate dice rolls
For equally likely outcomes, P(A) = favourable outcomes / total outcomes
- 2.210 min Read
Conditional Probability
Probability when we already know something
Code: spam given a word
P(A|B) = P(A∩B) / P(B)
- 2.312 min Read
Bayes' Theorem
Updating a belief with new evidence, using a medical test example
Code: the rare-disease test
P(A|B) = P(B|A)P(A) / P(B)
- 2.412 min Read
Probability Distributions and the Normal Curve
Uniform, binomial and normal distributions, and z-scores
Code: simulate heights
z = (x − μ) / σ
- 2.510 min Read Activity
Entropy and Information
Measuring uncertainty with entropy, cross-entropy and information gain
Code: information gain for a decision-tree split
H = −Σ p log₂ p
Chapter 3 Linear Algebra
- 3.110 min Read
Vectors and Matrices
How data becomes rows and columns of numbers
Code: represent students as vectors
- 3.210 min Read
Vector Operations and the Dot Product
Adding, scaling and comparing vectors
Code: similarity between two users
a·b = Σ aᵢbᵢ
- 3.310 min Read
Distance and Similarity
Euclidean distance and cosine similarity
Code: find the most similar document
d = √Σ(aᵢ − bᵢ)²
- 3.410 min Read
Matrix Multiplication
Combining tables, as every neural network layer does
Code: a bill for many customers at once
(AB)ᵢⱼ = Σ AᵢₖBₖⱼ
- 3.512 min Read Activity
Eigenvalues and Eigenvectors
Directions a matrix only stretches, and why PCA and PageRank use them
Code: power iteration and a tiny PageRank
Av = λv
Chapter 4 Calculus Intuition
- 4.18 min Read Activity
- 4.210 min Read
Slope and the Derivative
How fast a value changes, in pictures first
Code: estimate a slope numerically
f′(x) ≈ (f(x+h) − f(x)) / h
- 4.312 min Read Activity
Gradients and Gradient Descent
Walking downhill to make an error smaller
Interactive: roll a ball to the bottom of a curve
θ ← θ − η∇L
- 4.410 min Read Activity
Partial Derivatives and the Chain Rule
Derivatives with many inputs, and the rule that powers backpropagation
Code: check a chain-rule gradient numerically
dy/dx = (dy/du)(du/dx)
- 4.515 min Read Activity