Lecture 3
Lecture 3
review (optional)
Matrices and
vectors
Machine Learning
Andrew Ng
Matrix: Rectangular array of numbers:
Andrew Ng
Vector: An n x 1 matrix.
Andrew Ng
Linear Algebra
review (optional)
Addition and scalar
multiplication
Machine Learning
Andrew Ng
Matrix Addition
Andrew Ng
Scalar Multiplication
Andrew Ng
Combination of Operands
Andrew Ng
Linear Algebra
review (optional)
Matrix-vector
multiplication
Machine Learning
Andrew Ng
Example
Andrew Ng
Details:
m x n matrix n x 1 matrix
m-dimensional
(m rows, (n-dimensional
vector
n columns) vector)
Andrew Ng
House sizes:
Andrew Ng
Linear Algebra
review (optional)
Matrix-matrix
multiplication
Machine Learning
Andrew Ng
Example
Andrew Ng
Details:
m x n matrix n x o matrix
mxo
(m rows, (n rows,
matrix
n columns) o columns)
2 7
Andrew Ng
House sizes: Have 3 competing hypotheses:
1.
2.
3.
Matrix Matrix
Andrew Ng
Linear Algebra
review (optional)
Matrix multiplication
properties
Machine Learning
Andrew Ng
Let and be matrices. Then in general,
(not commutative.)
E.g.
Andrew Ng
Let Compute
Let Compute
Andrew Ng
Identity Matrix
Denoted (or ).
Examples of identity matrices:
2x2
3x3
4x4
For any matrix ,
Andrew Ng
Linear Algebra
review (optional)
Inverse and
transpose
Machine Learning
Andrew Ng
Not all numbers have an inverse.
Matrix inverse:
If A is an m x m matrix, and if it has an inverse,
Andrew Ng