Maths 3.1Lesson outlineLesson 1 of 7 in Module 3
Matrices, the Matrix–Vector Product and the Transpose
See a dataset as a matrix, and a linear model's predictions as one matrix–vector product.
Video in production.
Learn
In this lesson12 parts
- 01One row at a time
- 02A table as a matrix
- 03The matrix–vector product, row by row
- 04The same product, column by column
- 05The shape rule
- 06The transpose
- 07Column means and the centred matrix
- 08Checkpoint: matrices so far
- 09The shop year as one product
- 10Transposing and centring the shop year
- 11Matrices in NumPy
- 12Recap, challenge, and next: transformations
Key terms
The words this lesson introduces, each in one line. The module’s glossary collects them all.
- matrix
- a rectangular table of numbers, treated as one object; rows are samples, columns are features |
X = [[2, 1], [0, 3], [4, 2]] - shape
- the number of rows, then the number of columns |
(3, 2) - entry
- one number in a matrix,
xᵢⱼ|x₃₂ = 2 - matrix–vector product
- each row of the matrix dotted with the vector, one output per row |
Xw = (5, −3, 10) - linear combination
- vectors, each multiplied by a number, then added |
3·col₁ − 1·col₂ - shape rule
- the matrix's number of columns must equal the vector's length; the result has one entry per row |
(3, 2) @ (2,) → (3,) - transpose
- rows become columns; an
n × dmatrix becomesd × n|Xᵀ,(2, 3) - column mean
- the average of one column, one number per feature |
(2, 2) - centred matrix
- each column minus its mean, so every column mean is zero |
[[0, −1], [−2, 1], [2, 0]]
Quiz
Your first pick on each question is the one that counts, and a right one earns a coin. Getting one wrong here is how the lesson sticks.