Matrices

17 min read

A matrix is a table of numbers. Neural networks use matrices to turn an input into an answer. In this lesson you read a matrix, multiply it with a vector, and see how one layer of a network works.

New words

Matrix
A table of numbers with rows and columns.
Shape
The size of a matrix: rows × columns.
Matrix multiplication
Take dot products of rows with columns. NumPy writes it as @.
Transpose
Flip a matrix so rows become columns. NumPy writes it as .T.
Weights
The numbers a model learns. A layer stores them in a matrix.
Bias
A number added after the multiplication to shift the answer.

What you will learn

  1. Where do matrices show up in AI?
  2. What is a matrix?
  3. How do you multiply a matrix with a vector?
  4. What is the shape rule?
  5. Matrix times matrix, and the transpose
  6. What is a neural network layer?
  7. Is a photo a matrix?
  8. Try it: multiply row by row
  9. What mistakes do people make?
  10. Explain it to a friend
  11. Key takeaways

10 quiz questions at the end.

Start this lesson

The full lesson, with interactive demos and the quiz, opens after you sign in with Google. It is free.

All lessons · Back to the roadmap