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!
AI Artist for today: Holly Herndon
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.
See the power of matrix multiplication with this
interactive demo
More from Holly Herndon
Holly+
Next, we are going to:
- take a look at more simple python basics!
A prepared google colab notebook
1. click on the link and open this google colab notebook
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! 🎉
An example of running fun "niche" AI models using colab notebook:
a text-to-3D model called dreamfield
- Have you seen the "Open in Colab" button?
Let's play with the dreamfield Colab notebook
a text-to-3D model called dreamfield
- 1. Open the notebook by clicking the "Open in Colab" button in the readme section.
- 2. Run all the code cells except the marked "optional" ones.
- 3. Some cells take a long time to run and you can expand the cell to see what it is doing.
- 4. Prompt_text under "Training Settings" is where you can type in your own prompt.
- 4.5. Maybe enter a small value of Epoch_num under "Training Settings" if you are in a hurry.
- 5. If you have entered a new prompt, make sure you run the following code cells again to get the updated results.
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!