Top Banner
Unsupervised Learning Principal Component Analysis CMSC 422 MARINE CARPUAT [email protected] Slides credit: Maria-Florina Balcan
15

Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

Sep 28, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

Unsupervised LearningPrincipal Component Analysis

CMSC 422

MARINE CARPUAT

[email protected]

Slides credit: Maria-Florina Balcan

Page 2: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

Unsupervised Learning

• Discovering hidden structure in data

• Last time: K-Means Clustering

– What is the objective optimized?

– How can we improve initialization?

– What is the right value of K?

• Today: how can we learn better

representations of our data points?

Page 3: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

Dimensionality Reduction

• Goal: extract hidden lower-dimensional

structure from high dimensional datasets

• Why?

– To visualize data more easily

– To remove noise in data

– To lower resource requirements for

storing/processing data

– To improve classification/clustering

Page 4: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

Examples of data points in D dimensional

space that can be effectively represented in

a d-dimensional subspace (d < D)

Page 5: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

Principal Component Analysis

• Goal: Find a projection of the data onto

directions that maximize variance of the

original data set

– Intuition: those are directions in which most

information is encoded

• Definition: Principal Components are

orthogonal directions that capture most of

the variance in the data

Page 6: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

PCA: finding principal

components

• 1st PC

– Projection of data points along 1st PC

discriminates data most along any one

direction

• 2nd PC

– next orthogonal direction of greatest

variability

• And so on…

Page 7: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

PCA: notation

• Data points

– Represented by matrix X of size DxN

– Let’s assume data is centered

• Principal components are d vectors: 𝑣1, 𝑣2, … 𝑣𝑑– 𝑣𝑖 . 𝑣𝑗 = 0, 𝑖 ≠ 𝑗 and 𝑣𝑖 . 𝑣𝑖 = 1

• The sample variance data projected on vector v

is 1𝑛 𝑖=1𝑛 (𝑣𝑇𝑥𝑖)2 = 𝑣𝑇𝑋𝑋𝑇 𝑣

Page 8: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

PCA formally

• Finding vector that maximizes sample

variance of projected data:

𝑎𝑟𝑔𝑚𝑎𝑥𝑣 𝑣𝑇𝑋𝑋𝑇 𝑣 such that 𝑣𝑇𝑣 = 1

• A constrained optimization problem

Lagrangian folds constraint into objective:

𝑎𝑟𝑔𝑚𝑎𝑥𝑣 𝑣𝑇𝑋𝑋𝑇 𝑣 − 𝜆𝑣𝑇𝑣

Solutions are vectors v such that 𝑋𝑋𝑇 𝑣 = 𝜆𝑣

i.e. eigenvectors of 𝑋𝑋𝑇 (sample covariance matrix)

Page 9: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

PCA formally

• The eigenvalue 𝜆 denotes the amount of variability

captured along dimension 𝑣

– Sample variance of projection 𝑣𝑇𝑋𝑋𝑇 𝑣 = 𝜆

• If we rank eigenvalues from large to small

– The 1st PC is the eigenvector of 𝑋𝑋𝑇 associated

with largest eigenvalue

– The 2nd PC is the eigenvector of 𝑋𝑋𝑇 associated

with 2nd largest eigenvalue

– …

Page 10: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

Alternative interpretation of PCA

• PCA finds vectors v such that projection on

to these vectors minimizes reconstruction

error

Page 11: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

Resulting PCA algorithm

Page 12: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

How to choose the

hyperparameter K?

• i.e. the number of dimensions

• We can ignore the components of smaller

significance

Page 13: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

An example: Eigenfaces

Page 14: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

PCA pros and cons

• Pros

– Eigenvector method

– No tuning of the parameters

– No local optima

• Cons

– Only based on covariance (2nd order statistics)

– Limited to linear projections

Page 15: Principal Component Analysis · 2016. 5. 16. · –Represented by matrix X of size DxN –Let’s assume data is centered •Principal components are d vectors: 𝑣1,𝑣2,…𝑣𝑑

What you should know

• Formulate K-Means clustering as an optimization

problem

• Choose initialization strategies for K-Means

• Understand the impact of K on the optimization

objective

• Why and how to perform Principal Components

Analysis