matrices and vectors

25
Andrew Ng Linear Algebra review (optional) Matrices and vectors Machine Learning

Upload: quinto

Post on 22-Feb-2016

98 views

Category:

Documents


0 download

DESCRIPTION

Linear Algebra review (optional). Matrices and vectors. Machine Learning. Matrix: Rectangular array of numbers:. Dimension of matrix: number of rows x number of columns. Matrix Elements (entries of matrix). “ , entry” in the row, column. Vector: An n x 1 matrix. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Matrices and vectors

Andrew Ng

Linear Algebra review (optional)

Matrices and vectors

Machine Learning

Page 2: Matrices and vectors

Andrew Ng

Dimension of matrix: number of rows x number of columns

Matrix: Rectangular array of numbers:

Page 3: Matrices and vectors

Andrew Ng

Matrix Elements (entries of matrix)

“ , entry” in the row, column.

Page 4: Matrices and vectors

Andrew Ng

Vector: An n x 1 matrix.

1-indexed vs 0-indexed:element

Page 5: Matrices and vectors

Andrew Ng

Linear Algebra review (optional)Addition and scalar multiplication

Machine Learning

Page 6: Matrices and vectors

Andrew Ng

Matrix Addition

Page 7: Matrices and vectors

Andrew Ng

Scalar Multiplication

Page 8: Matrices and vectors

Andrew Ng

Combination of Operands

Page 9: Matrices and vectors

Andrew Ng

Linear Algebra review (optional)

Matrix-vector multiplication

Machine Learning

Page 10: Matrices and vectors

Andrew Ng

Example

Page 11: Matrices and vectors

Andrew Ng

Details:

m x n matrix(m rows,

n columns)

n x 1 matrix(n-dimensional

vector)

m-dimensional vector

To get , multiply ’s row with elements of vector , and add them up.

Page 12: Matrices and vectors

Andrew Ng

Example

Page 13: Matrices and vectors

Andrew Ng

House sizes:

Page 14: Matrices and vectors

Andrew Ng

Linear Algebra review (optional)

Matrix-matrix multiplication

Machine Learning

Page 15: Matrices and vectors

Andrew Ng

Example

Page 16: Matrices and vectors

Andrew Ng

Details:

m x n matrix(m rows,

n columns)

n x o matrix(n rows,

o columns)

m x omatrix

The column of the matrix is obtained by multiplying with the column of . (for = 1,2,…,o)

Page 17: Matrices and vectors

Andrew Ng

Example

2 7

7

Page 18: Matrices and vectors

Andrew Ng

House sizes:

Matrix Matrix

Have 3 competing hypotheses:1.2.3.

Page 19: Matrices and vectors

Andrew Ng

Linear Algebra review (optional)Matrix multiplication properties

Machine Learning

Page 20: Matrices and vectors

Andrew Ng

Let and be matrices. Then in general,(not commutative.)

E.g.

Page 21: Matrices and vectors

Andrew Ng

LetLet

ComputeCompute

Page 22: Matrices and vectors

Andrew Ng

Identity Matrix

For any matrix ,

Denoted (or ).Examples of identity matrices:

2 x 23 x 3

4 x 4

Page 23: Matrices and vectors

Andrew Ng

Linear Algebra review (optional)

Inverse and transpose

Machine Learning

Page 24: Matrices and vectors

Andrew Ng

Not all numbers have an inverse.

Matrix inverse:If A is an m x m matrix, and if it has an inverse,

Matrices that don’t have an inverse are “singular” or “degenerate”

Page 25: Matrices and vectors

Andrew Ng

Matrix TransposeExample:

Let be an m x n matrix, and let Then is an n x m matrix, and