Checkpoint
Matrices are machines
Twelve questions on matrices as maps, products and shapes, with new numbers and a few classic traps. Work them without the lessons open. You need 80% to pass. The code question needs one line of numpy.
- 1
A linear map sends to and to . Which matrix represents it?
- 2
Compute for and .
Ax - 3
Which of these can be done by multiplying by a matrix? Select all that apply.
- 4
Find the single matrix that first applies the shear and then stretches horizontally by 3 with .
- 5
Let and . What is , the entry in row 2 and column 1?
- 6
In numpy,
ahas shape(8, 1)andbhas shape(3,). What doesa + bdo? - 7
An MLP maps 20 input features through two hidden layers of 50 units each to 5 outputs. Every layer is dense with a bias. How many parameters does it have?
- 8
Which expression equals for matrices whose shapes fit?
- 9
is , is and is . You compute with whichever grouping is cheaper. How many multiply-adds does it take?
- 10
Two dense layers with no nonlinearity between them compute in the row-batch convention. Which single layer gives the same outputs?
- 11
Write the matrix that rotates the plane a quarter turn clockwise.
- 12
Code it A colleague stores a layer's weights in the math convention:
Whas shape(d_out, d_in), so one input column becomes . Your data is a batchXof shape(batch, d_in), one example per row. Writelayer(X, W, b)so that it returns every example's output as a row, shape(batch, d_out), without a Python loop.