Skip to content

Week 6 Lecture 1

Principal Component Analysis

  • How to reduce to π‘˜<𝑑 variables, such that as much information is preserved as possible?
  • How many dimensions are required to capture a certain percentage of information?

Orthogonal matrix (iff. basis is orthonormal):

π‘ˆπ‘‡=π‘ˆβˆ’1

Semi-orthogonal: orthonormal in the lowest dimension

Semi-orthogonal matrices are semi-unitary:

π‘ˆπ‘‡π‘ˆ=πΌβˆ¨π‘ˆπ‘ˆπ‘‡=𝐼

Eigenvectors and Eigenvalues

𝑆𝑒𝑖=πœ†π‘–π‘’π‘–

We only care about Eigenvectors of unit length, and with the following ordering:

𝑖<π‘—β‡’πœ†π‘–β‰₯πœ†π‘—

Eigencomposition of real symmetric matrix

For a real symmetric matrix 𝑀, the decomposition is:

𝑀=𝑄Λ𝑄𝑇

Where:

  • π‘„βˆˆβ„π‘‘Γ—π‘‘ is orthogonal
  • Ξ›βˆˆβ„π‘‘Γ—π‘‘=diag(πœ†1,…,πœ†π‘‘) where πœ†π‘– are the eithervalues
  • The columns of 𝑄 are corresponding eigenvectors

Singular value decomposition

For any(!) matrix 𝑋:

𝑋=π‘ˆΞ“π‘‰π‘‡

for π‘Ÿ=min{𝑁,𝑑}

  • π‘ˆβˆˆβ„π‘Γ—π‘Ÿ Semi-orthogonal
  • Ξ“=diag(𝛾1,…,π›Ύπ‘Ÿ)βˆˆβ„π‘ŸΓ—π‘Ÿ with 𝛾1β‰₯…β‰₯π›Ύπ‘Ÿβ‰₯0
  • π‘‰βˆˆβ„π‘‘Γ—π‘Ÿ Semi-orthogonal

𝛾𝑖 are NOT the eigenvectors!!! They are the singular values

PCA

Basic idea is to find an affine linear function that can map back to the dataset’s dimention as accurately as possible. (by selecting a smaller π‘˜ as input dimension)

The linear function’s coefficient π‘ˆπ‘˜βˆˆβ„π‘‘Γ—π‘˜ has pairwise orthogonal columns, all unit length

Reconstruction error is calculated by a sum-of-squares error

Formal goal is to find affine model and 𝑧𝑖 projected data points that minimizes sum-of-squares

Solution

For the 𝑏 bias, use the empirical mean of the data points

Datapoints should be encoded as:

𝑧𝑖=π‘ˆπ‘˜π‘‡(π‘₯π‘–βˆ’π‘₯Μ…)

The π‘ˆπ‘˜ vector is made out of the first π‘˜ eigenvectors of the data covariance matrix (S):

𝑆=1π‘βˆ‘π‘–=1𝑁(π‘₯π‘–βˆ’π‘₯Μ…)(π‘₯π‘–βˆ’π‘₯)𝑇
PCA assumes our distribution is Gaussian.
In short, PCA is a heuristic to not care about all the features, but the rest should be normalized for most algorithms