

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Principal component analysis (pca), a technique used to find a representation of data in a lower-dimensional space while preserving most of the original information. Two ways of deriving pca: maximizing variance and minimizing reconstruction error. It also provides the algorithm for performing pca on a dataset.
Typology: Study Guides, Projects, Research
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Machine Learning (CS 5350/CS 6350) 25 Mar 2008
Often we want to find a representation of data from RD^ in some lower-dimenaional space, RK^ , for K D. For K ∈ { 2 , 3 }, this is useful for visualization. For other K, it’s useful if we believe that the data is noisy, or not ideal for our learning algorithm (eg., kNN).
Have data matrix in X ∈ RN^ ×D^. Want to linearly project X into some Z ∈ RN^ ×K^. We don’t want to lose much “information.”
Two ways of deriving PCA:
(1) is standard, hence the name “principle component analysis” (a component is a basis vector).
First, center X so it has mean 0.
Now, supposed we want to find a single dimension to project down on to. Represent this dimension by a vector u, so that Z = Xu. We want to find u so that V[Z] = V[Xu] is maximized. We have to be careful to ensure that u is a unit vector; otherwise we get trivial uninteresting solutions. This turns into an optimization problem:
max u:||u||=
V[Xu] = max u:||u||=
n
u>xn
= max u:||u||=
||Xu||^2
To solve this, we construct the Lagrangian by adding a multiplier for the constraint ||u||^2 = 1 (changing to squared norm doesn’t change the problem); we also throw out the (^) N^1 because it is a constant. Then we take the gradient and set it equal to zero.
L(u, λ) = ||Xu||^2 − λ
||u||^2 − 1
∇uL = 2(X>X)u − 2 λu = 0 ⇐⇒(X>X)u = λu
So now all we need to do is solve the above for u. Note that this has the form Au = λu where A is defined as X>X. The solution to this problem is a vector u that is an eigenvector of A and can be computed “easily” (use eig or eigs in Matlab/Octave).
When you get eigenvectors/eigenvalues of a matrix A of size D × D, you will get D-many pairs (ui, λi). The λs are measures of the variance along the corresponding u, so we want to select the ui with largest corresponding λi.
In general, to project onto K > 1 dimensions, instead of choosing the single eigenvector with largest eigen- value, we take the top K (they are guaranteed to be orthogonal).
Machine Learning (CS 5350/CS 6350) 2
The algorithm looks like:
An alternative way of thinking about PCA is as minimizing a reconstruction error. If we have a data point xn and project it with xnU 7 → zn, then we can “unproject” by znU>^7 → ˜xn. We can look at the reconstruction error ||xn − ˜xn||^2 and try to minimize this over U, where we constrain U to be orthonormal (i.e., orthogonal and unit vectors). The one-dimensional case is easier to see:
min u
n
||xn − x˜n||^2 = min u
n
∣xn − xnuu>
= min u
n
||xn||^2 − (xn>u)^2
= (constant) + min u
n
(xn>u)^2
= (constant) − max u
n
(xn>u)^2
= (constant) − max u ||Xu||^2
Here, the last line is exactly (modulo the constant) the same optimization we had in the variance case.
The intuition behind PCA is that we’re trying to find (non-axis-aligned) basis vectors along which X has highest variance. Doing so turns into an eigenvalue problem which we know how to solve. The second intuition is that we’re trying to minimize reconstruction error (measured in terms of squared error) and this reverts to the same thing.