Computer Vision: Spring 2006 15-385,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm - 4:20pm
Computer Vision: Spring 2006 15-385,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm - 4:20pm
Instructor: S. Narasimhan
Wean 5403
T-R 3:00pm – 4:20pm
Lecture #19
Principal Components Analysis
Lecture #19
Data Presentation
Value
500
400
H - W B C H - R B C H - H g b H - H c t H - M C V H - M C H H - M C H C
300
200
A 1 8 . 0 0 0 0 4 . 8 2 0 0 1 4 . 1 0 0 0 4 1 . 0 0 0 0 8 5 . 0 0 0 0 2 9 . 0 0 0 0 3 4 . 0 0 0 0
A 2 7 . 3 0 0 0 5 . 0 2 0 0 1 4 . 7 0 0 0 4 3 . 0 0 0 0 8 6 . 0 0 0 0 2 9 . 0 0 0 0 3 4 . 0 0 0 0
A 3 4 . 3 0 0 0 4 . 4 8 0 0 1 4 . 1 0 0 0 4 1 . 0 0 0 0 9 1 . 0 0 0 0 3 2 . 0 0 0 0 3 5 . 0 0 0 0
100
00
A 4 7 . 5 0 0 0 4 . 4 7 0 0 1 4 . 9 0 0 0 4 5 . 0 0 0 0 1 0 1 . 0 0 0 0 3 3 . 0 0 0 0 3 3 . 0 0 0 0
A 5 7 . 3 0 0 0 5 . 5 2 0 0 1 5 . 4 0 0 0 4 6 . 0 0 0 0 8 4 . 0 0 0 0 2 8 . 0 0 0 0 3 3 . 0 0 0 0
10 20 30 40 50 60
A 6 6 . 9 0 0 0 4 . 8 6 0 0 1 6 . 0 0 0 0 4 7 . 0 0 0 0 9 7 . 0 0 0 0 3 3 . 0 0 0 0 3 4 . 0 0 0 0
measurement
Measurement
A 7 7 . 8 0 0 0 4 . 6 8 0 0 1 4 . 7 0 0 0 4 3 . 0 0 0 0 9 2 . 0 0 0 0 3 1 . 0 0 0 0 3 4 . 0 0 0 0
A 8 8 . 6 0 0 0 4 . 8 2 0 0 1 5 . 8 0 0 0 4 2 . 0 0 0 0 8 8 . 0 0 0 0 3 3 . 0 0 0 0 3 7 . 0 0 0 0
A 9 5 . 1 0 0 0 4 . 7 1 0 0 1 4 . 0 0 0 0 4 3 . 0 0 0 0 9 2 . 0 0 0 0 3 0 . 0 0 0 0 3 2 . 0 0 0 0
Data Presentation
C-LDH
H-Bands
1 350
0.8 300
0.6 250
0.4 200
0.2 150
100
0 50
0 10 20 30 40 50 60 70 0 50 150 250 350 450
Person Trivariate C-Triglycerides
4
3
M-EPI
0
600
400 500
400
200 300
C-LDH 00
100
200
C-Triglycerides
Data Presentation
30
• All principal components
25
(PCs) start at the origin of
Wavelength 2
20
the ordinate axes. 15
PC 1
• First PC is direction of 10
origin 0 0 5 10 15 20 25 30
Wavelength 1
• Subsequent PCs are
30
orthogonal to 1st PC and
25
describe maximum Wavelength 2
20
residual variance 15
PC 2
10
0 0 5 10 15 20 25 30
Wavelength 1
The Goal
• Uses: • Examples:
– How many unique “sub-sets” are in the
– Data Visualization sample?
– Data Reduction – How are they similar / different?
– What are the underlying factors that
– Data Classification influence the samples?
– Trend Analysis – Which time / temporal trends are
(anti)correlated?
– Factor Analysis – Which measurements are needed to
– Noise Reduction differentiate?
– How to best present what is “interesting”?
– Which “sub-set” does this new sample
rightfully belong?
Trick: Rotate Coordinate Axes
Suppose we have a population measured on p random
variables X1,…,Xp. Note that these random variables
represent the p-axes of the Cartesian coordinate system in
which the population resides. Our goal is to develop a new
set of p axes (linear combinations of the original p axes) in
the directions of greatest variability:
X2
X1
y y
(x, y)
x
r
x
Minimize: E r b( x, y ) dx dy
2
Which equation of line to use?
y
(x, y)
r
x
y mx b ? 0m
We use:
x sin y cos 0 are finite
Minimizing Second Moment
dE
Using 0 we get: A( x sin y cos ) 0
d
dE b
Using 0 we get: tan 2
d ac
b ac
sin 2 cos 2
b 2 (a c) 2 b 2 (a c) 2
Emin
roundedness
Emax
END of FLASHBACK!
Algebraic Interpretation
• Choose a line that fits the data so the points are spread out well
along the line
Algebraic Interpretation – 1D
Line P P P… P Point 1 L
t t t … t Point 2 i
1 2 3… m Point 3 n
: e
Point m
xT BT B x
Algebraic Interpretation – 1D
• Rewriting this:
xTBTBx = e = e xTx = xT (ex)
<=> xT (BTBx – ex) = 0
• So, find the largest e and associated x such that the matrix BTB when applied to x
yields a new vector which is in the same direction as x, only scaled by a factor e.
Algebraic Interpretation – 1D
(BTB)x
ex=(BTB)x
x
Algebraic Interpretation – 1D
• How many eigenvectors are there?
• For Real Symmetric Matrices
– 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.
Algebraic Interpretation – 1D
such that:
2
4.0 4.5 5.0 5.5 6.0
PCA Scores
2
4.0 4.5 5.0 xi1 5.5 6.0
PCA Eigenvalues
5
λ1 λ2
2
4.0 4.5 5.0 5.5 6.0
PCA: Another Explanation
From k original variables: x1,x2,...,xk:
Produce k new variables: y1,y2,...,yk:
y1 = a11x1 + a12x2 + ... + a1kxk
y2 = a21x1 + a22x2 + ... + a2kxk
yk's are
...
Principal Components
yk = ak1x1 + ak2x2 + ... + akkxk
such that:
• Covariance Matrix:
– Variables must be in same units
– Emphasizes variables with most variance
– Mean eigenvalue ≠1.0
• Correlation Matrix:
– Variables are standardized (mean 0.0, SD 1.0)
– Variables can be in different units
– All variables have same impact on analysis
– Mean eigenvalue = 1.0
PCA: General
{a11,a12,...,a1k} is 1st Eigenvector of correlation/covariance
matrix, and coefficients of first principal component
• Purposes
– simplify data
– look at relationships between variables
– look at patterns of units
PCA: Yet Another Explanation
Classification in Subspace
• Dimensionality reduction
– We can represent the orange points with only their v1 coordinates
• since v2 coordinates are all essentially 0
– This makes it much cheaper to store and compare points
– A bigger deal for higher dimensional problems
Linear Subspaces
Consider the variation along direction v
among all of the orange points:
• Feature Vector
FeatureVector = (eig1 eig2 eig3 … eign)
We can either form a feature vector with both of
the eigenvectors:
-.677873399 -.735178656
-.735178656 .677873399
or, we can choose to leave out the smaller, less
significant component and only have a single
column:
- .677873399
- .735178656
PCA Example –STEP 5
x
-.827970186
1.77758033
-.992197494
-.274210416
-1.67580142
-.912949103
.0991094375
1.14457216
.438046137
1.22382056
Next Class