6CS012 – Artificial Intelligence and Machine Learning��Week – 1�
Introduction to Linear Algebra and Derivatives for Deep Learning��A quick revision on Linear Algebra
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
1
About the module!
What the module is about?
How to pass the module?
2
What the module is about?
Learning Objectives:
3
Learning Outcome:
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
4
Module Prerequisites
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning – Copyright of images not claimed
5
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning – Copyright of images not claimed
6
Learning Outcomes!!!
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
7
Introduction to Linear Algebra
Why to study Linear Algebra for Machine Learning?
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
8
What is Linear Algebra?
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
9
Why Linear Algebra for Machine Learning?
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
10
Why Linear Algebra for Machine Learning?
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
11
Why Linear Algebra for Machine Learning?
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
12
Why Linear Algebra for Machine Learning?
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
13
Summary : Linear Algebra for Machine Learning.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
14
Review: What are Vectors?
15
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning – Copyright of images not claimed
Direction in space
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
16
Point in space�
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
17
In Machine Learning
The geometric interpretation of vectors as points in space allow us to consider a training set of input examples in ML as a collection of points in space
So, for eg.
classification can be viewed as discovering how to separate two clusters of points/vectors belonging to different classes
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
18
Scalars?
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
19
Scalar times vector
20
Scalar times vector
21
Scalar times vector
22
Operations on Vectors
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
23
Addition on Vectors
Add element-wise.
Can only add vectors of equal dimensions.
Associative and commutative
24
Element-by-element product (Hadamard product)
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
25
Properties of a vector
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
26
Dot product (inner product)
27
1 X N
N X 1
1 X 1
Outer dimensions give
size of resulting matrix
Geometric Intuition
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
28
Takes 2 vectors of the same dimension, returns a scalar
A measure of the “alignment” between two vectors, scaled by the lengths.
Geometric Intuition
Question
What happens when two vectors are orthogonal?
Dot product?
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
29
Geometric Intuition
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
30
Vector Space
x + y ∈ V with the addition properties
ax ∈ V with the scalar multiplication properties:
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
31
Linear Combination
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
32
Linear Combination
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
33
Span
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
34
Linear Dependence and Independence
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
35
Linearly dependent
w ∈ span (u, v)
Linearly independent
Matrix
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
36
Review What are Matrices?�
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
37
Intuitions on Matrix -1
As a table of data
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
38
Intuitions on Matrix -2
39
Intuitions on Matrix -3
Interpretation 2: Linear Transformation on Vectors
Multiplying a m x n matrix into a n x 1 vector yields a m x 1 vector.
We can think of this as a linear function from n-dimensional to m-dimensional space.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
40
Image source : https://mathematica.stackexchange.com/questions/151238/how-to-use-manipulate-to-show-linear-transformation-of-matrix
Ax → y
Intuitions on Matrix -4
Intuition 3: As Linear Equations
y = Ax
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
41
Special Matrices.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
42
Special Matrices.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
43
Special Matrices Design Matrix.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
44
Matrix Operation: Arithmetic.
Matrix – Matrix Sum:
Matrix – Scalar Multiplication:
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
45
Matrix Operation: Arithmetic.
Matrix – vector Multiplication:
Computes the dot product of each row of A with x
Hadamard Product:
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
46
Matrix Operation: Arithmetic.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
47
Matrix multiplication is an operation that combines two matrices to produce a new matrix. It involves multiplying corresponding elements of rows and columns, then summing the products.
A * B = C
Conditions: The number of columns in the first matrix (A) must equal the number of rows in the second matrix (B).
Properties:
Associativity: (A * B) * C = A * (B * C)
Distributivity: A * (B + C) = A * B + A * C
Not Commutative (in general): A * B ≠ B * A
Transpose
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
48
Inverse
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
49
Pseudo Inverse of Matrices
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
50
Determinant of a matrix
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
51
Determinant of the matrix
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
52
Rank of a matrix
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
53
Matrix Decomposition-Eigen.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
54
What do matrices do to vectors?
1) rotated
2) scaled
55
(3,5)
(2,1)
Eigen Vector and Eigen Values.
Ax = λx
x is an eigenvector of A corresponding to eigenvalue, λ.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
56
Computing Eigen Vector and Eigen Values.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
57
Eigen Decomposition.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
58
For a matrix A with n linearly independent eigenvectors: A = VΛV⁻¹
V = matrix of eigenvectors
Λ = diagonal matrix of eigenvalues
Key Applications of Eigen Decompositions
• Finding matrix inverse: A⁻¹ = VΛ⁻¹V⁻¹ (when no eigenvalue is zero)
• Computing determinant: det(A) = product of eigenvalues
• Analysing matrix properties (positive/negative definite semi-definite, etc.)
Eigen Decomposition-Geometric Interpretation.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
59
Review : What are Tensors?
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
60
What are Tensors?
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
61
Tensor Example.
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
62
Plan
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
63
Thank You!!!
Week - 1 - Introduction to Linear Algebra and Derivatives for Deep Learning
64