machine learning for signal processing
play

Machine Learning for Signal Processing Fundamentals of Linear - PowerPoint PPT Presentation

Machine Learning for Signal Processing Fundamentals of Linear Algebra Class 2. 3 Sep 2013 Instructor: Bhiksha Raj 3 Sep 2013 11-755/18-797 1 Administrivia Change of classroom: BH A51 Being broadcast to west coast Registration:


  1. Machine Learning for Signal Processing Fundamentals of Linear Algebra Class 2. 3 Sep 2013 Instructor: Bhiksha Raj 3 Sep 2013 11-755/18-797 1

  2. Administrivia • Change of classroom: BH A51 – Being broadcast to west coast • Registration: Anyone on waitlist still? • Homework 1: Will appear over weekend. – Linear algebra • Both TAs have office hours from 9.30am-11.30am on Fridays – Location TBD, still waiting for info from ECE 3 Sep 2013 11-755/18-797 2

  3. Overview • Vectors and matrices • Basic vector/matrix operations • Vector products • Matrix products • Various matrix types • Projections 3 Sep 2013 11-755/18-797 3

  4. Book • Fundamentals of Linear Algebra, Gilbert Strang • Important to be very comfortable with linear algebra – Appears repeatedly in the form of Eigen analysis, SVD, Factor analysis – Appears through various properties of matrices that are used in machine learning, particularly when applied to images and sound • Today’s lecture: Definitions – Very small subset of all that’s used – Important subset, intended to help you recollect 3 Sep 2013 11-755/18-797 4

  5. Incentive to use linear algebra • Pretty notation!   y j x i a ij   T x A y j i • Easier intuition – Really convenient geometric interpretations ฀ – Operations easy to describe verbally • Easy code translation! for i=1:n for j=1:m C=x*A*y c(i)=c(i)+y(j)*x(i)*a(i,j) end end 3 Sep 2013 11-755/18-797 5

  6. And other things you can do From Bach’s Fugue in Gm Frequency  Rotation + Projection + Time  Decomposition (NMF) Scaling + Perspective • Manipulate Images • Manipulate Sounds 3 Sep 2013 11-755/18-797 6

  7. Scalars, vectors, matrices, … • A scalar a is a number – a = 2, a = 3.14, a = -1000, etc. • A vector a is a linear arrangement of a collection of scalars , a  3.14     a  1 2 3    32   • A matrix A is a rectangular arrangement of a collection of scalars  10   A  3.12 ฀   10.0 2   • MATLAB syntax: a=[1 2 3], A=[1 2;3 4] ฀ 3 Sep 2013 11-755/18-797 7

  8. Vectors • Vectors usually hold sets of numerical attributes – X, Y, Z coordinates • [1, 2, 0] [-2.5av 6st] – Earnings, losses, suicides [1av 8st] • [$0 $1,000,000 3] – A location in Manhattan • [3av 33st] • Vectors are either column or row vectors   a     , s    c  , r  a b b c   [2av 4st]   c   – A sound can be a vector, a series of daily temperatures can be a vector, etc … ฀ 3 Sep 2013 11-755/18-797 8

  9. Vectors in the abstract • Ordered collection of numbers – Examples: [3 4 5], [a b c d], .. – [3 4 5] != [4 3 5]  Order is important • Typically viewed as identifying ( the path from origin to ) a location in an N-dimensional space (3,4,5) 5 (4,3,5) 3 z y 4 x 3 Sep 2013 11-755/18-797 9

  10. Matrices • Matrices can be square or rectangular         S  a b , R  a b c   , M      c d d e f           – Images can be a matrix, collections of sounds can be a matrix, etc. – A matrix can be vertical stacking of row vectors ฀   a b c  R     d e f – Or a horizontal arrangement of column vectors   a b c  R     d e f 3 Sep 2013 11-755/18-797 10

  11. Dimensions of a matrix • The matrix size is specified by the number of rows and columns   a       c b , r a b c       c – c = 3x1 matrix: 3 rows and 1 column – r = 1x3 matrix: 1 row and 3 columns     a b a b c   S   , R       c d d e f – S = 2 x 2 matrix – R = 2 x 3 matrix – Pacman = 321 x 399 matrix 3 Sep 2013 11-755/18-797 11

  12. Representing an image as a matrix • 3 pacmen • A 321 x 399 matrix – Row and Column = position • A 3 x 128079 matrix – Triples of x,y and value • A 1 x 128079 vector – “Unraveling” the matrix   1 1 . 2 . 2 2 . 2 . 10 Y   1 2 . 1 . 5 6 . 10 . 10 X      1 1 . 1 . 0 0 . 1 . 1  v • Note: All of these can be recast as the   1 1 . 1 1 . 0 0 0 . . 1 matrix that forms the image Values only; X and Y are – Representations 2 and 4 are equivalent implicit • The position is not represented 3 Sep 2013 11-755/18-797 12

  13. Vectors vs. Matrices (3,4,5) 5 4 3 • A vector is a geometric notation for how to get from (0,0) to some location in the space • A matrix is simply a collection of vectors! – Properties of matrices are average properties of the traveller’s path to the vector destinations 3 Sep 2013 11-755/18-797 13

  14. Basic arithmetic operations • Addition and subtraction – Element-wise operations 1  b 1  b             a b a a b a 1 1 1 1 1 1             a  b    a 2  b 2 a  b    a 2  b 2 a 2 b 2 a 2 b 2                  a 3  b 3       a 3  b 3  a 3 b 3 a 3 b 3             11  b 12  b A  B  a  a  b   b   a  a  11 12 11 12 11 12     ฀ ฀ a 21  b 21 a 22  b 22 a 21 a 22 b 21 b 22       • MATLAB syntax: a+b and a-b ฀ 3 Sep 2013 11-755/18-797 14

  15. Vector Operations 3 (3,4,5) -2 5 (3,-2,-3) -3 4 (6,2,2) 3 • Operations tell us how to get from origin to the result of the vector operations – (3,4,5) + (3,-2,-3) = (6,2,2) 3 Sep 2013 11-755/18-797 15

  16. Operations example   1 1 . 2 . 2 2 . 2 . 10   1 2 . 1 . 5 6 . 10 . 10      1 1 . 1 . 0 0 . 1 . 1  + + Random(3,columns(M))   1 1 . 1 1 . 0 0 0 . . 1   1 1 . 2 . 2 2 . 2 . 10   1 2 . 1 . 5 6 . 10 . 10      1 1 . 1 . 0 0 . 1 . 1  • Adding random values to different representations of the image 3 Sep 2013 11-755/18-797 16

  17. Vector norm (3,4,5) Length = sqrt(3 2 + 4 2 + 5 2 ) • Measure of how big a vector is: 5 x – Represented as a 2  b 2  ... 2    a b ... • Geometrically the shortest ฀ 4 distance to travel from the origin ฀ 3 to the destination – As the crow flies [-2av 17st] [-6av 10st] – Assuming Euclidean Geometry • MATLAB syntax: norm(x) 3 Sep 2013 11-755/18-797 17

  18. Transposition • A transposed row vector becomes a column (and vice versa)     a a     , x T  a , y T      y  a x  b b c b c b         c c     • A transposed matrix gets all its row (or column) vectors transposed in order ฀ ฀       a d X  a  b c    , X T      , M T  M  b e         d e f         c f       • MATLAB syntax: a’ 3 Sep 2013 11-755/18-797 18 ฀ ฀

  19. Vector multiplication • Multiplication is not element-wise! • Dot product, or inner product – Vectors must have the same number of elements – Row vector times column vector = scalar   d       a  d  b  e  c  f a b c e     f   • Outer product or vector direct product – Column vector times row vector = matrix ฀ a  d a  e a  f     a         d b  d b  e b  f b e f        c  d c  e c  f  c     • MATLAB syntax: a*b 3 Sep 2013 11-755/18-797 19 ฀

  20. Vector dot product in Manhattan • Example: – Coordinates are yards, not ave/st – a = [200 1600], [200yd 1600yd] b = [770 300] norm ≈ 1612 • The dot product of the two vectors relates to the length of a projection – How much of the first vector have we covered by following the second one? – Must normalize by the length of the “target” vector   770    norm 200 1600   a  b T 300 ≈ 393yd     393yd [770yd 300yd]   a norm ≈ 826 200 1600 ฀ 3 Sep 2013 11-755/18-797 20

Recommend


More recommend