Principal Component Analysis

Total Page:16

File Type:pdf, Size:1020Kb

Principal Component Analysis Principal Component Analysis Weitao, Tan August 9, 2018 Instructor: Junwen Peng 1 Introduction The principle component analysis is a mathematical way to find main axes for multidimensional data set. In some conditions of data mining and machine learning, the data is usually saved in an array(as a vector). In fact, those vectors usually have thousands of dimensions, and we need to reduce the dimension of the data vector in order to process those data. Reducing the dimension of data will cause the loss of some data, and because the principle component analysis can give us the main axes of the data set, we can project each data input onto the main axes to minimize the amount of lost data. For example, the pca algorithms are used commonly in Face Preception. Each pixel with its neighbor pixel of our face picture is a data in one dimension. It is a millions of dimensional data set for entire face picture. By applying pca, we can find which pixel contributes most to make the whole picture different. It reduces the runtime for identification program significantly. 2 What is the Principal Component Analysis The Principal Component Analysis is an algorithms to find principal axes for multidimensional data set. It can be used to analyze and to simplified large data sets. By projecting data to the main axes, it can reduce the dimensions of data set while keeping relatively more important data. The reason it will work is based on the principle axie theorem. 2.1 Principal axis theorem A principal axis is a certain line in a Euclidean space associated with an ellipsoid or hyperboloid, generalizing the major and minor axes of an ellipse or hyperbola. The principal axis theorem gives a constructive procedure for finding the princepal axes. The principal axis theorem concerns quadratic forms in Rn, which are homogeneous polynomials of degree 2. Here is an example: Ax2 + Bxy + Cy2. Any quadratic form may be represented as 1 Q(x) = xT Mx (1) where M is a symmetric matrix. For example, Ax2 + Bxy + Cy2 is equal to [x; y] ∗ M ∗ [x; y]T for some matrix M. The principal axis theorem tells us that each eigenvector of Q(x) represent a principal axie of the ellipse or hyperbola. 2.2 Principal Component Analysis When principal axis theorem can compute the principal axis for one data input, the principal component analysis does it for multiple data. The first step of principal component analysis is to make the data set centered at zero. The second step is to get the co-variance Matrix of the data set which is similar with summation and averaging of each single data input. Finally, calculate the eigenvalue and its vector for the principle axes for the data set. 3 PCA algorithms This is the step one: making the data set centered at zero. Data: double [ ] [ ] matrix Result: double [ ] [ ] matrix n; m = matrix.dimension; aij = matrix.input; Pn aij i=1 avej = n ; for aij : matrix do aij = aij - avej end Algorithm 1: changeAverageToZero algorithms This is the step two: getting the co-variance Matrix of the data set. Data: double [ ] [ ] matrix Result: double [ ] [ ] matrix n; m = matrix.dimension; matrixT = matrix.Transpose; matrixT ∗matrix matrix = n ; Algorithm 2: getVarianceMatrix; This is the step three: computing the eigenvalues and vectors. Data: double [ ] [ ] matrix Result: double [ ] eigenvalue; double [ ] [ ] eigenvector; matrix = matrix.changeAverageToZero;(get zero-centered data set) matrix = matrix.getVarianceMatrix;(get co-Variance matrix) eigenvalue = matrix.getEigenvalue;(get Eigenvalue for matrix; eigenvector = matrix.getEigenVectorMatrix;(get Eigenvectors for matrix) Algorithm 3: PCA algorithms 2 4 Data input and data result 4.1 Example result for rectangular data set In this graph, the data input is rectangular like, the red point shows the eigenvectors scaled by the unit size. The eigenvalues are 0.082 and 0.750, so the vector with 0.750 eigenvalue (pointing right) is the major axis. 4.2 Example result for oval data set In this graph, the data input is oval like, the red point shows the eigenvectors scaled by the unit size. The eigenvalues are 0.231 and 0.798, so the vector with 0.798 eigenvalue (pointing right) is the major axis. 4.3 Example result for oval data set spining 30o In this graph, the data input is same as the previous example, but spinned clockwise by 30o, the red point shows the eigenvectors scaled by the unit size. 3 The eigenvalues are 0.231 and 0.798, so the vector with 0.798 eigenvalue (pointing rightdown) is the major axis. Because the data is get from spinning the previous one, so the major axis does not change. 5 The restriction of the PCA and solutions PCA algorithm also has some restrictions. The main restriction is that the main data set should be in a simply connnected domain. If two parts of data set are disconneceted from each other, for example, one part is loacated in a circle with radius 2 centered at (2,2), and another part is located in a cicle with redius 1 centered at (-3,-3), the principle analysis will give you the vector which connect two circle centers. A way to solve this kind of restriction is to apply the pca for each part of data separately, then use the result to analyze them separately. Another restriction is that if two eigenvalue get from pca are very close, it will be difficult to say which axes is more important. The solution to solve this one is to use eigenvector as input data set to apply the pca again until there is a difference between the eigenvalue. 4.
Recommended publications
  • Basic Concepts of Linear Algebra by Jim Carrell Department of Mathematics University of British Columbia 2 Chapter 1
    1 Basic Concepts of Linear Algebra by Jim Carrell Department of Mathematics University of British Columbia 2 Chapter 1 Introductory Comments to the Student This textbook is meant to be an introduction to abstract linear algebra for first, second or third year university students who are specializing in math- ematics or a closely related discipline. We hope that parts of this text will be relevant to students of computer science and the physical sciences. While the text is written in an informal style with many elementary examples, the propositions and theorems are carefully proved, so that the student will get experince with the theorem-proof style. We have tried very hard to em- phasize the interplay between geometry and algebra, and the exercises are intended to be more challenging than routine calculations. The hope is that the student will be forced to think about the material. The text covers the geometry of Euclidean spaces, linear systems, ma- trices, fields (Q; R, C and the finite fields Fp of integers modulo a prime p), vector spaces over an arbitrary field, bases and dimension, linear transfor- mations, linear coding theory, determinants, eigen-theory, projections and pseudo-inverses, the Principal Axis Theorem for unitary matrices and ap- plications, and the diagonalization theorems for complex matrices such as the Jordan decomposition. The final chapter gives some applications of symmetric matrices positive definiteness. We also introduce the notion of a graph and study its adjacency matrix. Finally, we prove the convergence of the QR algorithm. The proof is based on the fact that the unitary group is compact.
    [Show full text]
  • Chapter 8. Eigenvalues: Further Applications and Computations
    8.1 Diagonalization of Quadratic Forms 1 Chapter 8. Eigenvalues: Further Applications and Computations 8.1. Diagonalization of Quadratic Forms Note. In this section we define a quadratic form and relate it to a vector and ma- trix product. We define diagonalization of a quadratic form and give an algorithm to diagonalize a quadratic form. The fact that every quadratic form can be diago- nalized (using an orthogonal matrix) is claimed by the “Principal Axis Theorem” (Theorem 8.1). It is applied in Section 8.2 to address quadratic surfaces. Definition. A quadratic form f(~x) = f(x1, x2,...,xn) in n variables is a polyno- mial that can be written as n f(~x)= u x x X ij i j i,j=1; i≤j where not all uij are zero. Note. For n = 2, a quadratic form is f(x, y)= ax2 + bxy + xy2. The graph of such an equation in the xy-plane is a conic section (ellipse, hyperbola, or parabola). For n = 3, we have 2 2 2 f(x1, x2, x3)= u11x1 + u12x1x2 + u13x1x3 + u22x2 + u23x2x3 + u33x2. We’ll see in the next section that the graph of f(x1, x2, x3) is a quadric surface. We 8.1 Diagonalization of Quadratic Forms 2 can easily verify that u11 u12 u13 x1 [f(x1, x2, x3)]= [x1, x2, x3] 0 u22 u23 x2 . 0 0 u33 x3 Definition. In the quadratic form ~xT U~x, the matrix U is the upper-triangular coefficient matrix of the quadratic form. Example. Page 417 Number 4(a).
    [Show full text]
  • Chapter 6 Eigenvalues and Eigenvectors
    Chapter 6 Eigenvalues and Eigenvectors Po-Ning Chen, Professor Department of Electrical and Computer Engineering National Chiao Tung University Hsin Chu, Taiwan 30010, R.O.C. 6.1 Introduction to eigenvalues 6-1 Motivations • The static system problem of Ax = b has now been solved, e.g., by Gauss- Jordan method or Cramer’s rule. • However, a dynamic system problem such as Ax = λx cannot be solved by the static system method. • To solve the dynamic system problem, we need to find the static feature of A that is “unchanged” with the mapping A. In other words, Ax maps to itself with possibly some stretching (λ>1), shrinking (0 <λ<1), or being reversed (λ<0). • These invariant characteristics of A are the eigenvalues and eigenvectors. Ax maps a vector x to its column space C(A). We are looking for a v ∈ C(A) such that Av aligns with v. The collection of all such vectors is the set of eigen- vectors. 6.1 Eigenvalues and eigenvectors 6-2 Conception (Eigenvalues and eigenvectors): The eigenvalue-eigenvector pair (λi, vi) of a square matrix A satisfies Avi = λivi (or equivalently (A − λiI)vi = 0) where vi = 0 (but λi can be zero), where v1, v2,..., are linearly independent. How to derive eigenvalues and eigenvectors? • For 3 × 3 matrix A, we can obtain 3 eigenvalues λ1,λ2,λ3 by solving 3 2 det(A − λI)=−λ + c2λ + c1λ + c0 =0. • If all λ1,λ2,λ3 are unequal, then we continue to derive: Av1 = λ1v1 (A − λ1I)v1 = 0 v1 =theonly basis of the nullspace of (A − λ1I) Av λ v ⇔ A − λ I v ⇔ v A − λ I 2 = 2 2 ( 2 ) 2 = 0 2 =theonly basis of the nullspace of ( 2 ) Av3 = λ3v3 (A − λ3I)v3 = 0 v3 =theonly basis of the nullspace of (A − λ3I) and the resulting v1, v2 and v3 are linearly independent to each other.
    [Show full text]
  • Principal Component Analysis
    02.01.2019 Prncpal component analyss - Wkpeda Principal component analysis Principal component analysis (PCA) is a statistical procedure that uses an orthogonal transformation to convert a set of observations of possibly correlated variables (entities each of which takes on various numerical values) into a set of values of linearly uncorrelated variables called principal components. If there are observations with variables, then the number of distinct principal components is . This transformation is defined in such a way that the first principal component has the largest possible variance (that is, accounts for as much of the variability in the data as possible), and each succeeding component in turn has the highest variance possible under the constraint that it is orthogonal to the preceding components. The resulting vectors (each being a linear combination of the variables and containing n PCA of a multivariate Gaussian observations) are an uncorrelated orthogonal basis set. PCA is sensitive to distribution centered at (1,3) with a the relative scaling of the original variables. standard deviation of 3 in roughly the (0.866, 0.5) direction and of 1 in PCA was invented in 1901 by Karl Pearson,[1] as an analogue of the the orthogonal direction. The principal axis theorem in mechanics; it was later independently developed vectors shown are the eigenvectors of the covariance matrix scaled by and named by Harold Hotelling in the 1930s.[2] Depending on the field of the square root of the corresponding application, it is also named the discrete Karhunen–Loève transform eigenvalue, and shifted so their tails (KLT) in signal processing, the Hotelling transform in multivariate quality are at the mean.
    [Show full text]
  • Chapter 4 Symmetric Matrices and the Second Derivative Test
    Symmetric matrices and the second derivative test 1 Chapter 4 Symmetric matrices and the second derivative test In this chapter we are going to ¯nish our description of the nature of nondegenerate critical points. But ¯rst we need to discuss some fascinating and important features of square matrices. A. Eigenvalues and eigenvectors Suppose that A = (aij) is a ¯xed n £ n matrix. We are going to discuss linear equations of the form Ax = ¸x; where x 2 Rn and ¸ 2 R. (We sometimes will allow x 2 Cn and ¸ 2 C.) Of course, x = 0 is always a solution of this equation, but not an interesting one. We say x is a nontrivial solution if it satis¯es the equation and x 6= 0. DEFINITION. If Ax = ¸x and x 6= 0, we say that ¸ is an eigenvalue of A and that the vector x is an eigenvector of A corresponding to ¸. µ ¶ 0 3 EXAMPLE. Let A = . Then we notice that 1 2 µ ¶ µ ¶ µ ¶ 1 3 1 A = = 3 ; 1 3 1 µ ¶ 1 so is an eigenvector corresponding to the eigenvalue 3. Also, 1 µ ¶ µ ¶ µ ¶ 3 ¡3 3 A = = ¡ ; ¡1 1 ¡1 µ ¶ 3 so is an eigenvector corresponding to the eigenvalue ¡1. ¡1 µ ¶ µ ¶ µ ¶ µ ¶ 2 1 1 1 1 EXAMPLE. Let A = . Then A = 2 , so 2 is an eigenvalue, and A = µ ¶ 0 0 0 0 ¡2 0 , so 0 is also an eigenvalue. 0 REMARK. The German word for eigenvalue is eigenwert. A literal translation into English would be \characteristic value," and this phrase appears in a few texts.
    [Show full text]
  • Geometric Number Theory Lenny Fukshansky
    Geometric Number Theory Lenny Fukshansky Minkowki's creation of the geometry of numbers was likened to the story of Saul, who set out to look for his father's asses and discovered a Kingdom. J. V. Armitage Contents Chapter 1. Geometry of Numbers 1 1.1. Introduction 1 1.2. Lattices 2 1.3. Theorems of Blichfeldt and Minkowski 10 1.4. Successive minima 13 1.5. Inhomogeneous minimum 18 1.6. Problems 21 Chapter 2. Discrete Optimization Problems 23 2.1. Sphere packing, covering and kissing number problems 23 2.2. Lattice packings in dimension 2 29 2.3. Algorithmic problems on lattices 34 2.4. Problems 38 Chapter 3. Quadratic forms 39 3.1. Introduction to quadratic forms 39 3.2. Minkowski's reduction 46 3.3. Sums of squares 49 3.4. Problems 53 Chapter 4. Diophantine Approximation 55 4.1. Real and rational numbers 55 4.2. Algebraic and transcendental numbers 57 4.3. Dirichlet's Theorem 61 4.4. Liouville's theorem and construction of a transcendental number 65 4.5. Roth's theorem 67 4.6. Continued fractions 70 4.7. Kronecker's theorem 76 4.8. Problems 79 Chapter 5. Algebraic Number Theory 82 5.1. Some field theory 82 5.2. Number fields and rings of integers 88 5.3. Noetherian rings and factorization 97 5.4. Norm, trace, discriminant 101 5.5. Fractional ideals 105 5.6. Further properties of ideals 109 5.7. Minkowski embedding 113 5.8. The class group 116 5.9. Dirichlet's unit theorem 119 v vi CONTENTS 5.10.
    [Show full text]
  • The Principal Axis Theorem and Sylvester's Law of Inertia
    The principal axis theorem and Sylvester's law of inertia Jordan Bell [email protected] Department of Mathematics, University of Toronto April 3, 2014 The principal axis theorem is the statement that for any quadratic form on Rn there are coordinates in which the quadratic form is diagonal. Let Q(x) be a quadratic form on Rn. Then for some n × n real symmetric matrix A we have Q(x) = xT Ax for all x 2 Rn. If A is an n × n real symmetric matrix then by the spectral theorem there is an orthonormal basis of Rn each element of which is an eigenvector of A. Let λ1; : : : ; λn be the eigenvalues of A and let p1; : : : ; pn be the corresponding basis. Take P to be a matrix whose jth column is pj. Since the eigenvectors −1 T are orthonormal, it follows that P = P . Letting D = diag(λ1; : : : ; λn), we see that A = P DP T . We now apply the result of the spectral theorem to the quadratic form Q(x), getting Q(x) = xT P DP T x = (P T x)T D(P T x); which can be written as n T X 2 Q(P y) = y Dy = λjyj : j=1 T The coordinate vector of x with respect to the basis p1; : : : ; pn is y = P x, and Pn 2 we can write Q(x) in terms of y as j=1 λjyj . Sylvester's law of inertia tells us that if T T T Q(x) = (R x) diag(µ1; : : : ; µn)(R x) for some matrix R then jfµj : µj > 0gj = jfλj : λj > 0gj, jfµj : µj = 0gj = jfλj : λj = 0gj, and jfµj : µj < 0gj = jfλj : λj < 0gj.
    [Show full text]
  • Principal Component Analysis (Pca)
    A SURVEY: PRINCIPAL COMPONENT ANALYSIS (PCA) Sumanta Saha1, Sharmistha Bhattacharya (Halder)2 1Department of IT, Tripura University, Agartala,(India) 2Department of Mathematics, Tripura University, Agartala, (India) ABSTRACT Principal component analysis (PCA) is one of the most widely used multivariate techniques in statistics. It is commonly used to reduce the dimensionality of data in order to examine its underlying structure and the covariance/correlation structure of a set of variables. It is a statistical procedure that uses an orthogonal transformation to convert a set of observations of possibly correlated variables into a set of values of linearly uncorrelated variables called principal components. The number of principal components is less than or equal to the number of original variables. It is a way of identifying patterns in data, and expressing the data in such a way as to highlight their similarities and differences. This is the survey paper of the existing theory and techniques for PCA with example. Keywords: Correlation structure, Covariance structure, Multivariate Technique, Orthogonal Transformation, Principal Component. I. INTRODUCTION OF PRINCIPAL COMPONENTS ANALYSIS (PCA) Principal component analysis (PCA) is a statistical procedure that uses orthogonal transformation to convert a set of observations of possibly correlated variables into a set of values of linearly uncorrelated variables are called principal components. The number of principal components are less than or equal to the number of original variables. This transformation is defined in such a way that the first principal component has the largest possible variance (that is, accounts for as much of the variability in the data as possible), and each succeeding component in turn has the highest variance possible under the constraint that it be orthogonal to (i.e., uncorrelated with) the preceding components [3].
    [Show full text]
  • The Principal Axis Theorem for Holomorphic Functions
    PROCEEDINGS OF THE AMERICAN MATHEMATICAL SOCIETY Volume 128, Number 2, Pages 325{335 S 0002-9939(99)05451-9 Article electronically published on September 27, 1999 THE PRINCIPAL AXIS THEOREM FOR HOLOMORPHIC FUNCTIONS JOACHIM GRATER¨ AND MARKUS KLEIN (Communicated by Steven R. Bell) Abstract. An algebraic approach to Rellich’s theorem is given which states that any analytic family of matrices which is normal on the real axis can be diagonalized by an analytic family of matrices which is unitary on the real axis. We show that this result is a special version of a purely algebraic theorem on the diagonalization of matrices over fields with henselian valuations. 1. Introduction This paper aims at reviewing some more or less well known material from analysis and algebra which hopefully is put into some new perspective (at least it was new for the authors) by systematically exploring the relations between algebra and analysis. It is motivated by a well known theorem of analytic perturbation theory due to Rellich [Re]: Near z = 0, the eigenvalues of an analytic family A(z) of matrices which is hermitian (resp. normal) for real values of z can be chosen to be analytic, even in the case of eigenvalue degeneracies. This theorem is presented in several textbooks (see [Ba, Ka, RS]) where it is proven by use of a rather strong algebraic result: The branching behaviour of the eigenvalues of any analytic family of matrices is explicitly given in terms of Puiseux series. The proof of Rellich’s result then boils down to the observation that hermiticity (or normality) of the family excludes branching.
    [Show full text]
  • Differential Geometry Notes
    Mathematics 433/533; Class Notes Richard Koch March 24, 2005 ii Contents Preface vii 1 Curves 1 1.1 Introduction .................................... 1 1.2 Arc Length .................................... 2 1.3 Reparameterization ................................ 3 1.4 Curvature ..................................... 5 1.5 The Moving Frame ................................ 7 1.6 The Frenet-Serret Formulas ........................... 8 1.7 The Goal of Curve Theory ............................ 12 1.8 The Fundamental Theorem ........................... 12 1.9 Computers .................................... 14 1.10 The Possibility that κ = 0 ............................ 16 1.11 Formulas for γ(t) ................................. 20 1.12 Higher Dimensions ................................ 21 2 Surfaces 25 2.1 Parameterized Surfaces .............................. 25 2.2 Tangent Vectors ................................. 28 2.3 Directional Derivatives .............................. 31 2.4 Vector Fields ................................... 32 2.5 The Lie Bracket .................................. 32 2.6 The Metric Tensor ................................ 34 2.7 Geodesics ..................................... 38 2.8 Energy ....................................... 40 2.9 The Geodesic Equation ............................. 42 2.10 An Example .................................... 46 2.11 Geodesics on a Sphere .............................. 49 2.12 Geodesics on a Surface of Revolution ...................... 50 2.13 Geodesics on a Poincare Disk .........................
    [Show full text]
  • Orthogonality
    Part VII Orthogonality 547 Section 31 Orthogonal Diagonalization Focus Questions By the end of this section, you should be able to give precise and thorough answers to the questions listed below. You may want to keep these questions in mind to focus your thoughts as you complete the section. What does it mean for a matrix to be orthogonally diagonalizable and why • is this concept important? What is a symmetric matrix and what important property related to diago- • nalization does a symmetric matrix have? What is the spectrum of a matrix? • Application: The Multivariable Second Derivative Test In single variable calculus, we learn that the second derivative can be used to classify a critical point of the type where the derivative of a function is 0 as a local maximum or minimum. Theorem 31.1 (The Second Derivative Test for Single-Variable Functions). If a is a critical number of a function f so that f 0(a) = 0 and if f 00(a) exists, then if f (a) < 0, then f(a) is a local maximum value of f, • 00 if f (a) > 0, then f(a) is a local minimum value of f, and • 00 if f (a) = 0, this test yields no information. • 00 In the two-variable case we have an analogous test, which is usually seen in a multivariable calculus course. Theorem 31.2 (The Second Derivative Test for Functions of Two Variables). Suppose (a; b) is a critical point of the function f for which fx(a; b) = 0 and fy(a; b) = 0.
    [Show full text]
  • Topics in Matrix Theory Singular Value Decomposition
    Topics in Matrix Theory Singular Value Decomposition Tang Chiu Chak The University of Hong Kong 3rd July, 2014 Contents 1 Introduction 2 2 Review on linear algebra 2 2.1 Definition . .2 2.1.1 Operation for Matrices . .2 2.1.2 Notation and terminology . .3 2.2 Some basic results . .5 3 Singular value Decomposition 6 3.1 Schur's Theorem and Spectral Theorem . .6 3.2 Unitarily diagonalizable . .7 3.3 Singular value decomposition . .9 3.4 Brief disscussion on SVD . 10 3.4.1 Singular vector . 10 3.4.2 Reduced SVD . 11 3.4.3 Pseudoinverse . 11 4 Reference 12 1 1 Introduction In linear algebra, we have come across some useful theories related to matrices. For instance, eigenvalues of squared matrices, which in some sense translate com- plicated matrix multiplication to simple scalar multiplication and provide us a way to factorise some matrices into a nice form. However, most of the discussions in the courses are restricted in squared matrix with real entries. Will the theorems become different if we allow complex matirces? Can we extend the concept of eigenvalue to rectangular matrices? In response to these question, here we would like to first have a quick review on what we learned in linear algebra (but in the contest of complex matrices) and then study upon the idea of singular value{the "eigenvalue" for non-squared matrices. 2 Review on linear algebra 2.1 Definition An m by n matrix is a rectantgular array with m rows and n columns (and hence mn entries in total) and sometimes we will entriewise write an m by n ma- trix whose (i; j)-entry is aij as [aij]m×n.
    [Show full text]