Key points, notes and past questions
Singular Value Decomposition
Building and using the singular value decomposition. PCA is closely tied to it.
- Singular values and the Gram matrix
- $\sigma_i=\sqrt{\lambda_i(A^TA)}\ge0$.
- Σ has the shape of $A$.
- Sum of $\sigma^2$ equals the sum of squared entries.
- Symmetric matrix: $\sigma=\lvert\lambda\rvert$.
- Left and right singular vectors
- $u$: eigenvectors of $AA^T$. $v$: eigenvectors of $A^TA$.
- $v_i=A^Tu_i/\sigma_i$ fixes the sign.
- Check orthonormality first.
- $Q_2^T$ shows the $v_i$ as rows.
- Assembling and rebuilding
- $A=U\Sigma V^T=\sum\sigma_iu_iv_i^T$.
- Test Σ, then orthonormality, then pairs.
- $A=[Aq_i]\,Q^T$.
- Reading rank, subspaces and action
- Rank = number of non-zero singular values.
- Column space: first $r$ of $u$. Null space: last $n-r$ of $v$.
- $\lVert Ax\rVert^2=\sum(c_i\sigma_i)^2$.
Notes22 past questions in this topic
Principal Component Analysis
The chain from covariance to direction to projection.
- Centring and the covariance matrix
- Centre first.
- $C=\frac1nX^TX$ for centred rows.
- $C$ is symmetric and positive semidefinite.
- Shifting the data does not change $C$.
- Eigenvalues as variance
- Variance along unit $w$ is $w^TCw$.
- Total variance is the trace.
- Pattern $[a,b;b,a]$ gives $a\pm b$.
- $\lambda_j=\sigma_j^2/n$ for the centred data matrix.
- The principal direction
- Top eigenvalue, unit eigenvector.
- $v$ and $-v$ are equally correct.
- Collinear data: the line direction is the answer.
- Projection and reconstruction error
- $\tilde x=\mu+(w^T(x-\mu))w$.
- Average error = sum of dropped eigenvalues.
- Collinear data: zero error.
- The sign of $w$ does not change $\tilde x$.
- Properties of PCA and many features
- PCA is unsupervised.
- Scores are uncorrelated with variances $\lambda_j$.
- $v=A^Tu/\sqrt\lambda$.
- At most $n-1$ non-zero components from $n$ points.
Notes34 past questions in this topic
Week 5: Linear Algebra - Symmetric matricesWeek 7: Unconstrained OptimisationAll MLF topics and weeks