| Type |
|---|
| Preprocessing, Dimensionality Reduction |
Please see “Singular Value Decomposition” section under 2. Linear Algebra for SVD formulation.
Interpretation of U, Σ, and V
For an matrix , splits the map into rotate, scale, rotate:
| Matrix | Name | Meaning |
|---|---|---|
| () | Right singular vectors | Orthonormal basis of the input space. Columns are eigenvectors of : the directions stretches independently. rotates into this basis. |
| Singular values | Scales each direction by (the strength of that direction). | |
| () | Left singular vectors | Orthonormal basis of the output space. Columns are eigenvectors of : where the stretched directions land. |
The two bases are linked by : input direction maps to output direction , stretched by .
Dimensions: full vs. reduced SVD. is , not square: the singular values sit on its diagonal and every other entry is zero. The shapes chain as . For , :
The zero rows multiply the last columns of (where is the rank), so those columns never contribute to . The reduced (thin) SVD drops them: is , is , is , with or the rank. The product is still . In NumPy: np.linalg.svd(A, full_matrices=False).
Common uses:
- Compression: keep the top columns of and and top values of for the best rank- approximation.
- Recommendation Systems: describes row entities (users), describes column entities (items), and each column pair is a latent factor.
- Word Vectors: rows of (scaled by ) act as word embeddings.
Worked Example
Decompose as .
Step 1: Find and from .
The singular values are the square roots of the eigenvalues, sorted in descending order: and .
The unit eigenvectors of give the columns of :
Reminder: how to get and . For each eigenvalue, solve (find the null space), then divide by the vector’s length so it has unit norm.
Because is symmetric, automatically. See 2. Linear Algebra for eigenvectors.
Step 2: Find from .
Step 3: Assemble.
Step 4: Low-rank approximation (compression). Keeping only the largest singular value gives the best rank-1 approximation of :
The error is , so the discarded singular values measure exactly how much information is lost. In general, keeping the top singular values stores numbers instead of , which is why SVD is used for compression and dimensionality reduction.
For NumPy code reproducing this example, see SVD Snippets.
Limitations
Possible Limitations of SVD:
- Computational cost scales quadratically
- Different learning regime than other DL models
- Bad for millions of words or documents (if used for Word Vectors in NLP - See section “Representing with a Co-occurrence Matrix”)
- Hard to incorporate new words or documents (if used for Word Vectors in NLP - See section “Representing with a Co-occurrence Matrix”)