Download Linear Dimensionality Reduction - Lecture Slides | COMP 665 and more Study notes Computer Science in PDF only on Docsity!
Linear Dimensionality Reduc3on
10/13/08 Comp 665 – Principal Component Analysis 1
Overview
• What is Dimensionality Reduc@on?
– Finding “natural” parameteriza@on for data
– Compac@ng informa@on
• Dimensionality Reduc@on Methods
– Principle Component Analysis (PCA)
– Mul@‐Dimensional Scaling (MDS)
• Non‐Linear Dimensionality Reduc@on
– Next week
Uses for DimRedux
• Build a “compact” model of the data
- Compression for storage, transmission, & retrieval
- Parameters for indexing, exploring, and organizing
- Generate “plausible” new data
• Answer fundamental ques@ons about data
- What is its underlying dimensionality?
How many degrees of freedom, “latent variables”?
- How independent are my measurements?
Can I predict a measurement using others?
- Is there a projec@on of my data set where
important rela@onships stand out?
DimRedux in Data Modeling
Con@nuous to Discrete
- In higher dimensions, everything
tends to be equally far from
everything else
- Need a mapping to a lower
‐dimensional space that preserves
“important” rela@ons
Con@nuous to Con@nuous
generates input data
PCA: What problem does it solve?
- Minimizes “least‐squares” (Euclidean) error
- The D‐dimensional model provided by PCA has the smallest
Euclidean error of any D‐parameter linear model.
where is the model predicted by the D‐dimensional PCA.
- Projects data s.t. the variance is maximized
- Find an op@mal “orthogonal” basis set for
describing the given data
€
min ( ˜ x
i
− x
i
)
2
i = 1
M
∑
€
˜ x
Principle Component Analysis
- Recall our Temp examples from last lecture
- It was more compact to represent temps in terms of the average
temp and the average distance from the average temp than in
terms of high and low temperatures
- Generalize to “vector” variables
- Also known as Karhunen‐Loéve Transform (KLT)
- Rotate data points to align successive axes with direc@ons
of greatest variance
- Subtract mean from data
- Normalize variance along each direc@on, and reorder according
to the variance magnitude from high to low
- Normalized variance direc@on = principle component
- We need to a general no@on of variance
Deriva3on of PCA
• Express our points in terms of a linear model
• Such that is diagonal and
• Mul@plying by A gives:
10/13/08 Comp 665 – Principal Component Analysis 10
Ap =
x − E [
x ] = x
cov( p )
A
T
= A
− 1
Cov ( p ) = E [ p p
T
]
= E [( A
T
x )( A
T
x )
T
]
= E [( A
T
x )( x
T
A )]
= A
T
E [ x x
T
] A
= A
T
Cov ( x ) A
A Cov ( p ) = AA
T
Cov ( x ) A
A Cov ( p ) = Cov ( x ) A
Deriva3on of PCA (part 2)
• Recall
• Let a
i
be the i
th
column of A, then
• In other words, the principal components are just
eigenvectors of x’s covariance matrix
10/13/08 Comp 665 – Principal Component Analysis 11
Cov ( p ) =
λ
1
0 λ
2
0 0 λ
M
A Cov ( p ) = Cov ( x ) A → λ
i
a
i
= Cov ( x ) a
i
Simple PCA Example (cont)
 l, V = linalg.eigh(cov(y))
 order = argsort(‐l) # sort according to decreasing eigenvals
 >>> V = V[:, order]
 >>> l = l[order]
V
array([[‐0.65120644 0.71015682 ‐0.26759571]
[ 0.62419059 0.30065515 ‐0.72110512]
[ 0.43164369 0.63661902 0.63906177]])
l
array([ 330.04943221 84.37191699 1.874309 ])
mean(y, axis=1)
array([ 27.48028553 ‐8.66963228 63.24391026])
yn = y – resize(mean(y,axis=1), (100,3)).T
Simple PCA Example (cont)
yn = y – resize(mean(y,axis=1), (100,3)).T
plot = render.Axes3D(figure(2))
plot.scaper3D(yn[0,:], yn[1,:], yn[2,:])
for i in xrange(len(l)):
plot.plot3d(array([0.0, pdir[0,i]]),array([0.0, pdir[1,i]]),array([0.0, pdir[2,i]]))
show()
PCA Applied to Reillumina3on
• Illumina@on modeled as an addi@ve linear system.
R ( )
xy i
ω
Simula3ng New Ligh3ng
- We can simulate the appearance of a model under new illumina@on by
combining images taken from a set of basis lights
- We can then capture real‐world ligh@ng and use it to modulate our basis ligh@ng
func@ons
PCA Applied to Illumina3on
• More than 90%
variance is
captured in the
first five principle
components
• Generate new
illumina@on by
combining only 5
basis images
V
for n lights
Results Video