Master data processing, modeling, and deep learning algorithms.
Machine learning is, under the hood, mathematics: data lives in vectors and matrices, models make predictions with linear transformations, and training is an optimization problem solved with gradients. The math is not a hurdle — it is the language that makes algorithms precise and predictable. This lesson builds that language in three parts. Linear algebra (vectors, matrices, matrix multiplication, linear transformations) describes how data and models are represented. Calculus (derivatives, gradients, gradient descent) describes how models are trained. Probability and statistics (distributions, expectation, variance, hypothesis testing) describe uncertainty and how we judge results. The focus is intuition and application: what each idea means, and where it shows up in a real model.
| Shape | Meaning |
|---|---|
| (n, 1) | A column vector (one feature for n samples) |
| (1, n) | A row vector |
| (n, d) | A dataset of n samples with d features |
A matrix represents a linear transformation: it maps input vectors to output vectors. In a neural network, each layer multiplies its input by a weight matrix — a learned linear transformation.
Each step nudges the parameters downhill. The learning rate controls how big each step is.
| Learning rate | Effect |
|---|---|
| Too small | Converges slowly |
| Just right | Converges steadily |
| Too large | Overshoots or diverges |
| Distribution | Use in ML |
|---|---|
| Normal (Gaussian) | Noise, many natural measurements |
| Bernoulli | Binary outcomes (success/fail) |
| Uniform | Equal likelihood over a range |
Sampling draws data from a distribution. Understanding sampling lets you estimate model behavior from limited data.
These primitives (sum, zip, statistics) are enough to implement dot products, means, and variances by hand — the foundation of NumPy.
Multiply a 2×2 matrix by a 2×1 vector.
(each result entry is a dot product of a row with the column)
One step for f(x) = x^2 at x = 4.
(moving opposite the gradient moves downhill)
The long-run average of a fair six-sided die.
(the mean of the uniform distribution over 1..6)