5-dimension reduction
5-dimension reduction
5-dimension reduction
Liu Qi
Motivation
If your data lies on or near a low d-dimensional subspace.
Document classification:
Features per document =
thousands of words/unigrams, millions of bigrams,
contextual information
t-SNE: visualize similar words from Google News: it is more intuitive to explore data
Application 2: Dimensionality Reduction Saves
Computational Resources When Training Models
Autoencoder
Your task is to draw a straight line to separate the red and blue points
We can clearly see that the original data is non-linear and cannot be separated by a straight
line.
The data after applying Kernel PCA was plotted in the image at right.
−6 3 1
Matrix: Eigenvalue: 6 Eigenvector:
4 5 4
−6 3 1 6 1
= =6
4 5 4 24 4
Unit Vector
If 𝑣 is an eigenvector for matrix 𝐴, then for any constant 𝑐, 𝑐𝑣
is also an eigenvector. Why?
We know 𝐴𝑣 = 𝜆𝑣.
𝐴𝑣 = 𝜆𝑣 -> 𝐴 − 𝜆𝐼 𝑣 = 0
A fact of linear algebra is that in order for 𝐴 − 𝜆𝐼 𝑣 = 0 to hold
for a vector 𝑣 ≠ 0, the determinant of 𝐴 − 𝜆𝐼 must be 0.
3 2
2 6
3−𝜆 2
=0
2 6 −𝜆
3 2 𝑥 𝑥
2 6 𝑦 =7 𝑦
Therefore, 3𝑥 + 2𝑦 = 7𝑥 and 2𝑥 + 6𝑦 = 7𝑦
Therefore, 𝑥 = 1 and y = 2
1 2
Making it into a unit vector ( , )
5 5
Principal-Component Analysis (PCA)
Unsupervised technique for extracting low-dimensional features
from high-dimensional datasets.
The fact is that the axes with the largest variance are eigenvectors of the
matrix 𝐴𝑇 𝐴.
We first compute 𝐴𝑇 𝐴
1 2
1234 2 1 30 28
𝐴𝑇 A = =
2143 3 4 28 30
4 3
This is a symmetric matrix because 𝐴𝑇 𝐴 T
= 𝐴𝑇 𝐴.
Examples (Continued)
Then we find the eigenvalues and eigenvectors of 𝐴𝑇 A:
1 1
−
2 2
58, 2,
1 1
2 2
1 1 1 1
−
2 2 2 2 1 0
𝐵𝐵 𝑇 = =
1 1 1 1 0 1
−
2 2 2 2
PCA Applications: Face Recognition
Given face images of resolution 256 x 256 pixels, we can use
PCA to perform dimension reduction to reduce noises and
improve efficiency.
After PCA
After PCA, the face features are more significant.
Patch
SVD
Real World Meaning of SVD
We have r columns for U and V, where r is equal to the rank of the
matrix M.
What is the real word meaning of the matrices 𝑈, Σ, 𝑉 by SVD?
M: m × n
U: m × r
Σ: r × r
V: n × r
Real World Meaning of SVD (continued)
We can think each column of r as an “abstract concept”.
M: m × n -> user-movie matrix
U: m × r -> user-concept matrix
Σ: r × r -> eigenvalues
V: n × r -> movie-concept matrix
SVD
Query with Low-Dimensional Features
Given a user or movie, we can calculate the distance between its r-
dimensional features with the features of the other users or movies to
get similar users or movies.
Joe
(.13 .02 − .01)
Jane
(.07 − .029 .32)
PCA
SVD
References
http://infolab.stanford.edu/~ullman/mmds/ch11.pdf
Summary