ML One
Lecture 05
Introduction to vector and matrix multiplication
+
Python basics 01 continued
Welcome 👩🎤🧑🎤👨🎤
By the end of this lecture, we'll have learnt about:
The theoretical:
- How to multiply between a scalar and a matrix
- How to multiply between two vectors
- How to multiply between two matrices
- Intuition on vector and matrix multiplication
The practical:
- Python basics 01 continued
First of all, don't forget to confirm your attendence on
Seats App!
Recap
Scalar, vector and matrix 🧑🎨
- how to describe their shapes
-- number of rows x number of columns
-- how to add two matrices of the exactly same shape
2 x 3
Today we are going to see how to multiply things together, which is a significant part of what AI models are doing
:)
1. Multiply a vector/matrix with a scalar
- Multiply every element in the vector/matrix with the scalar
- that's why it gets the name "scalar"
1. Multiply a vector/matrix with a scalar
- Let's move to the
colab notebok.
- Scroll down to "Multiply matrices with a scalar"
1. Multiply a vector/matrix with a scalar
- Multiply every element in the vector/matrix with the scalar
- 🌶️ does the shape of the vector/matrix change after scalar multiplication?
1. Multiply a vector/matrix with a scalar
- Multiply every element in the vector/matrix with the scalar
- 🌶️ does the shape (dimensionaltiy) of the vector/matrix change after scalar multiplication?
- Nope, the shape does not change. The numebr of rows and number of columns stay the same.
2. Multiply two vectors
- There are several types of vector multiplication and each one has a different computation rule.
- 🌶️🌶️ In this unit we are only going to talk about one of them --
-- "dot product"
2.1 Dot product (inner product)
- Despite the strange name, it is a simple computation rule.
- with some profound implication! (we'll see later)
2.1 Dot product (inner product)
Let's move to the
colab notebok.
- Scroll down to "Multiply two vectors using dot product"
2.1 Dot product (inner product)
- Despite the strange name, it is a simple computation rule.
- 🌶️🌶️ What is the shape of the dot product between two vectors?
2.1 Dot product (inner product)
- Despite the strange name, it is yet another simple computation rule.
- 🌶️🌶️ What is the shape of the dot product between two vectors?
- 🌶️🌶️ A single number - scalar!
3. Multiply a matrix with a matrix
- Let's move to the
colab notebok.
- Scroll down to "Multiply two matrices"
- 🌶️🌶️ There is a shape rule.
Next, we are going to:
- take a look at more simple python basics!
Let's take a look at the notebook!
- 1. Make sure you have saved a copy to your GDrive or opened in playground. 🎉
- 2. Read all text cells and code cells in Conditionals, Loops and Functions.
- 3. Try the first excercise (Excercise 1.).
That's quite a lot, congrats! 🎉
Today we have looked at:
Scalar, vector and matrix 🧑🎨
- how to multiply with a scalar
-- how to take dot product between two vectors
-- how to multiply two matrices (the shape rule)
-- Dots will be connected in the future lecture! (You will see that matrices and their addition/multiplication are
actually the building blocks of AI models as well as many other cool stuff.)
We'll see you next Thursday same time and same place!