Machine Learning 2
DS 4420 - Spring 2020
Dimensionality reduction I
Byron C Wallace
Machine Learning 2 DS 4420 - Spring 2020 Dimensionality reduction I - - PowerPoint PPT Presentation
Machine Learning 2 DS 4420 - Spring 2020 Dimensionality reduction I Byron C Wallace Machine Learning 2 DS 4420 - Spring 2020 Some slides today borrowing from : Percy Liang (Stanford) Other material from the MML book (Faisal and Ong)
DS 4420 - Spring 2020
Byron C Wallace
DS 4420 - Spring 2020
Some slides today borrowing from: Percy Liang (Stanford) Other material from the MML book (Faisal and Ong)
images). We also often have lots of it.
Fundamental idea Exploit redundancy in the data; find lower-dimensional representation
−5.0 −2.5 0.0 2.5 5.0 x1 −4 −2 2 4 x2 −5.0 −2.5 0.0 2.5 5.0 x1 −4 −2 2 4 x2
This highlights the natural connection between dimensionality reduction and compression.
Original Data (4 dims) Projection with PCA (2 dims) Goal: Map high dimensional data onto lower-dimensional data in a manner that preserves distances/similarities Objective: projection should “preserve” relative distances
∈ x ∈ R361 z = U>x z ∈ R10
Idea: Project high-dimensional vector
Original Compressed Reconstructed
Key intuition: variance of data | {z }
fixed
= captured variance | {z }
want large
+ reconstruction error | {z }
want small
Λ = λ1 λ2 ... λd
U =( u1 ·· uk ) ∈ Rd⇥
Data Orthonormal Basis
X =( x1 · · · · · · xn) ∈ Rd⇥n
d
d
Eigenvectors of Covariance Eigen-decomposition Idea: Take top-k eigenvectors to maximize variance
S = 1 N
N
X
n=1
xnx>
n = 1
N XX>
S = 1 N
N
X
n=1
xnx>
n = 1
N XX>
Idea: Decompose the d x n matrix X into
(unitary matrix)
(diagonal projection)
(unitary matrix)
d X = Ud⇥dΣd⇥nV>
n⇥n
X
|{z}
D⇥N
= U
|{z}
D⇥D
Σ
|{z}
D⇥N
V >
|{z}
N⇥N
,
S = 1 N XX> = 1 N UΣ V >V
| {z }
=IN
Σ>U > = 1 N UΣΣ>U >
X
|{z}
D⇥N
= U
|{z}
D⇥D
Σ
|{z}
D⇥N
V >
|{z}
N⇥N
,
S = 1 N XX> = 1 N UΣ V >V
| {z }
=IN
Σ>U > = 1 N UΣΣ>U >
It turns out the columns of U are the eigenvectors of XXT
Example 10.3 (MNIST Digits Embedding)
the in
Top 2 components Bottom 2 components
Data: three varieties of wheat: Kama, Rosa, Canadian Attributes: Area, Perimeter, Compactness, Length of Kernel, Width of Kernel, Asymmetry Coefficient, Length of Groove
Xd×n u Ud×k Zk×n
. . .
Xd×n u Ud×k Zk×n
. . .
Idea: zi more “meaningful” representation of i-th face than xi Can use zi for nearest-neighbor classification
Xd×n u Ud×k Zk×n
. . .
Idea: zi more “meaningful” representation of i-th face than xi Can use zi for nearest-neighbor classification Much faster: O(dk + nk) time instead of O(dn) when n, d k
2 3 4 5 6 7 8 9 10 11
i
287.1 553.6 820.1 1086.7 1353.2
λi
=
Xd⇥n u Ud⇥k Zk⇥n
stocks: 2 · · · · · · · · · 0 chairman: 4 · · · · · · · · · 1 the: 8 · · · · · · · · · 7 · · · . . . · · · · · · · · · . . . wins: 0 · · · · · · · · · 2 game: 1 · · · · · · · · · 3)
u(
0.4 ·· -0.001 0.8 ·· 0.03 0.01 ·· 0.04 . . . ·· . . . 0.002 ·· 2.3 0.003 ·· 1.9 )( z1 . . . zn)
Xd⇥n u Ud⇥k Zk⇥n
stocks: 2 · · · · · · · · · 0 chairman: 4 · · · · · · · · · 1 the: 8 · · · · · · · · · 7 · · · . . . · · · · · · · · · . . . wins: 0 · · · · · · · · · 2 game: 1 · · · · · · · · · 3)
u(
0.4 ·· -0.001 0.8 ·· 0.03 0.01 ·· 0.04 . . . ·· . . . 0.002 ·· 2.3 0.003 ·· 1.9 )( z1 . . . zn)
How to measure similarity between two documents? z>
1 z2 is probably better than x> 1 x2
the latent space and hallucinate images
PCA is effective PCA is ineffective
Broken solution Desired solution We want desired solution: S = {(x1, x2) : x2 = u2
u1x2 1}
Broken solution Desired solution We want desired solution: S = {(x1, x2) : x2 = u2
u1x2 1}
We can get this: S = {φ(x) = Uz} with φ(x) = (x2
1, x2)>
{ }
Linear dimensionality reduction in φ(x) space ⇔ Nonlinear dimensionality reduction in x space
Idea: Use kernels
finds a mapping to a lower dimensional space that maximizes variance
eigendecomposition on the covariance matrix of X
non-linear projections
finds a mapping to a lower dimensional space that maximizes variance
eigendecomposition on the covariance matrix of X
non-linear projections
finds a mapping to a lower dimensional space that maximizes variance
eigendecomposition on the covariance matrix of X
non-linear projections