Algorithms 2005 Ramesh Hariharan. Algebraic Methods.

Slides:



Advertisements
Similar presentations
3D Geometry for Computer Graphics
Advertisements

Component Analysis (Review)
PCA + SVD.
1er. Escuela Red ProTIC - Tandil, de Abril, 2006 Principal component analysis (PCA) is a technique that is useful for the compression and classification.
Mathematics. Matrices and Determinants-1 Session.
Principal Components Analysis Babak Rasolzadeh Tuesday, 5th December 2006.
1cs542g-term High Dimensional Data  So far we’ve considered scalar data values f i (or interpolated/approximated each component of vector values.
Principal Component Analysis CMPUT 466/551 Nilanjan Ray.
Principal Component Analysis
Symmetric Matrices and Quadratic Forms
Computer Graphics Recitation 5.
3D Geometry for Computer Graphics
L15:Microarray analysis (Classification) The Biological Problem Two conditions that need to be differentiated, (Have different treatments). EX: ALL (Acute.
The Terms that You Have to Know! Basis, Linear independent, Orthogonal Column space, Row space, Rank Linear combination Linear transformation Inner product.
3D Geometry for Computer Graphics
Tutorial 10 Iterative Methods and Matrix Norms. 2 In an iterative process, the k+1 step is defined via: Iterative processes Eigenvector decomposition.
MOHAMMAD IMRAN DEPARTMENT OF APPLIED SCIENCES JAHANGIRABAD EDUCATIONAL GROUP OF INSTITUTES.
E.G.M. PetrakisDimensionality Reduction1  Given N vectors in n dims, find the k most important axes to project them  k is user defined (k < n)  Applications:
Boot Camp in Linear Algebra Joel Barajas Karla L Caballero University of California Silicon Valley Center October 8th, 2008.
1cs542g-term Notes  Extra class next week (Oct 12, not this Friday)  To submit your assignment: me the URL of a page containing (links to)
化工應用數學 授課教師: 郭修伯 Lecture 9 Matrices
Computer Vision Spring ,-685 Instructor: S. Narasimhan WH 5409 T-R 10:30am – 11:50am Lecture #18.
Matrices CS485/685 Computer Vision Dr. George Bebis.
Stats & Linear Models.
Dominant Eigenvalues & The Power Method
1 Statistical Analysis Professor Lynne Stokes Department of Statistical Science Lecture 5QF Introduction to Vector and Matrix Operations Needed for the.
Linear Algebra Review By Tim K. Marks UCSD Borrows heavily from: Jana Kosecka Virginia de Sa (UCSD) Cogsci 108F Linear.
SVD(Singular Value Decomposition) and Its Applications
Compiled By Raj G. Tiwari
Summarized by Soo-Jin Kim
Principle Component Analysis (PCA) Networks (§ 5.8) PCA: a statistical procedure –Reduce dimensionality of input vectors Too many features, some of them.
Linear Least Squares Approximation. 2 Definition (point set case) Given a point set x 1, x 2, …, x n  R d, linear least squares fitting amounts to find.
Linear Algebra Review 1 CS479/679 Pattern Recognition Dr. George Bebis.
BMI II SS06 – Class 3 “Linear Algebra” Slide 1 Biomedical Imaging II Class 3 – Mathematical Preliminaries: Elementary Linear Algebra 2/13/06.
Modern Navigation Thomas Herring
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm Lecture #19.
Digital Image Processing, 3rd ed. © 1992–2008 R. C. Gonzalez & R. E. Woods Gonzalez & Woods Matrices and Vectors Objective.
SVD: Singular Value Decomposition
Linear algebra: matrix Eigen-value Problems
Computing Eigen Information for Small Matrices The eigen equation can be rearranged as follows: Ax = x  Ax = I n x  Ax - I n x = 0  (A - I n )x = 0.
Chapter 5 Eigenvalues and Eigenvectors 大葉大學 資訊工程系 黃鈴玲 Linear Algebra.
Elementary Linear Algebra Anton & Rorres, 9 th Edition Lecture Set – 07 Chapter 7: Eigenvalues, Eigenvectors.
Eigenvalues The eigenvalue problem is to determine the nontrivial solutions of the equation Ax= x where A is an n-by-n matrix, x is a length n column.
Review of Matrix Operations Vector: a sequence of elements (the order is important) e.g., x = (2, 1) denotes a vector length = sqrt(2*2+1*1) orientation.
EIGENSYSTEMS, SVD, PCA Big Data Seminar, Dedi Gadot, December 14 th, 2014.
Signal & Weight Vector Spaces
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Krylov-Subspace Methods - I Lecture 6 Alessandra Nardi Thanks to Prof. Jacob White, Deepak Ramaswamy, Michal Rewienski, and Karen Veroy.
Chapter 61 Chapter 7 Review of Matrix Methods Including: Eigen Vectors, Eigen Values, Principle Components, Singular Value Decomposition.
Matrices CHAPTER 8.9 ~ Ch _2 Contents  8.9 Power of Matrices 8.9 Power of Matrices  8.10 Orthogonal Matrices 8.10 Orthogonal Matrices 
Unsupervised Learning II Feature Extraction
Boot Camp in Linear Algebra TIM 209 Prof. Ram Akella.
1 Objective To provide background material in support of topics in Digital Image Processing that are based on matrices and/or vectors. Review Matrices.
Computational Physics (Lecture 7) PHY4061. Eigen Value Problems.
CSE 554 Lecture 8: Alignment
Review of Linear Algebra
Elementary Linear Algebra Anton & Rorres, 9th Edition
Properties Of the Quadratic Performance Surface
COMP 175: Computer Graphics February 9, 2016
Degree and Eigenvector Centrality
Numerical Analysis Lecture 16.
Principal Component Analysis
Feature space tansformation methods
Symmetric Matrices and Quadratic Forms
Principal Components What matters most?.
Maths for Signals and Systems Linear Algebra in Engineering Lectures 13 – 14, Tuesday 8th November 2016 DR TANIA STATHAKI READER (ASSOCIATE PROFFESOR)
Linear Algebra Lecture 32.
Principal Component Analysis
Eigenvalues and Eigenvectors
Symmetric Matrices and Quadratic Forms
Presentation transcript:

Algorithms 2005 Ramesh Hariharan

Algebraic Methods

Principal Component Analysis Given m points in a n dimensional space, for large n, how does one project on to a 2 or 3 dimensional space while preserving broad trends in the data and allowing it to be visualized?

Principal Component Analysis Given m points in a n dimensional space, for large n, how does one project on to a 1 dimensional space? Choose a line that fits the data so the points are spread out well along the line

Principal Component Analysis Formally, minimize sum of squares of distances to the line. Why sum of squares? Because it allows fast minimization, assuming the line passes thru 0

Principal Component Analysis Minimizing sum of squares of distances to the line is the same as maximizing the sum of squares of the projections on that line, thanks to Pythagoras.

Principal Component Analysis How is the sum of squares of projection lengths expressed in algebraic terms? Point 1 Point 2 Point 3 : Point m LineLine P P P … P t t t … t … m L i n e AxATAT xTxT

Principal Component Analysis How is the sum of squares of projection lengths expressed in algebraic terms? max( x T A T Ax), subject to x T x = 1

Principal Component Analysis Rewriting this: x T A T Ax = e = e x T x = x T (ex) x T (A T Ax – ex) = 0 Show that the maximum value of x T A T Ax is obtained for x satisfying A T Ax=ex So, find the largest e and associated x such that the matrix A T A when applied to x yields a new vector which is in the same direction as x, only scaled by a factor e.

Principal Component Analysis (A T A)x points in some other direction in general x is an eigenvector and e an eigenvalue if x (A T A)x x ex=(A T A)x

Principal Component Analysis How many eigenvectors are there? For Real Symmetric Matrices except in degenerate cases when eigenvalues repeat, there are n eigenvectors x 1 …x n are the eigenvectors e 1 …e n are the eigenvalues all eigenvectors are mutually orthogonal and therefore form a new basis Eigenvectors for distinct eigenvalues are mutually orthogonal Eigenvectors corresponding to the same eigenvalue have the property that any linear combination is also an eigenvector with the same eigenvalue; one can then find as many orthogonal eigenvectors as the number of repeats of the eigenvalue. Show the above properties

Principal Component Analysis For matrices of the form A T A All eigenvalues are non-negative (show this)

Principal Component Analysis How are the eigenvectors computed? Since the eigenvectors form a basis: (A T A) y =(A T A) (a 1 x 1 +a 2 x 2 ……..+a n x n ) =a 1 e 1 x 1 +….+a n e n x n (A T A)(A T A) y=a 1 e 1 e 1 x 1 +….+a n e n e n x n Repeated application of A T A on almost any vector y converges to a scaled version of the eigenvector x 1 corresponding to the largest eigenvalue e 1. y should satisfy a 1 !=0 What happens if e 1 is a repeated eigen value?

Principal Component Analysis Algorithm for computing the fitting line Compute A T A Start with (almost) any vector y Repeatedly multiply A T A with y and rescale until convergence (in practice, a fixed number of times) The resulting direction is the fitting line direction!!

Principal Component Analysis Time taken for convergence How many iterations i before [a 1 (e 1 )^i] / [Σ a k (e k )^i ] > 1-ε a 1 (e 1 )^i ε > Σ a k>1 (e k>1 )^i a 1 (e 1 )^i ε > n a max (e 2 )^i a 1 /a max (e 1 /e 2 )^i > n/ε i > log(n/ε a max /a 1 ) / log(e 1 /e 2 )

Principal Component Analysis Optimization if A is mxn and m > mxm use AA T instead, eigenvector of AA T is easily converted to that of A T A (AA T )y=e’y =>A T (AA T )y=e’(A T y) =>(A T A)(A T y)=e’(A T y) =>A T y is the eigenvector of A T A

Principal Component Analysis New algorithm for computing the fitting line Compute B= A T A or AA T whichever is smaller Start with (almost) any vector y Repeatedly multiply B with y and rescale until convergence If B=A T A then the resulting direction is the fitting line direction If B=AA T then A T times the resulting direction is the fitting line direction

Principal Component Analysis Complexity Compute B= A T A or AA T : (cols x rows x cols) or (rows x cols x rows), whichever is smaller Iterations: cols x cols x numInterations or rows x rows x numIterations, whichever is smaller If B=AA T then multiplication with A T takes cols x rows

Principal Component Analysis The Conundrum in Practice For 9000x2000, B= A T A takes 2000x9000x2000 For 2000x9000, B= AA T takes 2000x9000x2000 Iterations: 2000x2000xnumIterations in both cases For 2000x9000, B= AA T and multiplication with A T takes 2000x9000 Yet, 9000x2000 takes 100 times what 2000x9000 takes!!!!

Principal Component Analysis A careful look at the code for i=0 to min(rows,cols) for j=0 to min(rows,cols) if rows<cols {for k=0 to cols B[i,j]=A[i,k]*A[j,k] } else {for k=0 to rows B[i,j]=A[k,i]*A[k,j] }

Principal Component Analysis A careful look at the code The AA T option shows strong locality of reference The A T A option shows strong non-locality of reference Caching misses cause a greater than 100 fold slowdown in the latter cache

Principal Component Analysis The solution Prior to doing A T A, move A into a linear array stored in column major order. Currently done using an extra array, can one save an array? More space usage is bad. How does one convert row major to col major order in place for a rectangular matrix? With this, both A T A and AA T take the same amount of time.

Principal Component Analysis Further dimensions Once the line along which projections are made is found, all points are projected to the space orthogonal to this line to find further dimensions, recursively. These dimensions are called principal components; usually only a few are computed. The strength associated with a dimension is the corresponding eigenvalue = the sum of squares of projection lengths The total sum of all eigenvalues over all eigenvectors is equal to the squares of the lengths of the point vectors themselves; the strength of an eigenvalue is expressed as a fraction of this quantity.

Principal Component Analysis Why normalize points? Assumption: Fitting line passes through the origin. This assumption is necessary for fast computation. If data is skewed along any dimension then good fitting lines need not pass through the origin; mean centering helps reduce this skew.