Neural Sync Active
Randomized SVD
Registry Synced
Randomized SVD
190 words
1 min read
Reading compass
Now · 2.1 Motivation
Randomized SVD
2.1 Motivation
Computing the full SVD of a large matrix is O(mn2) — infeasible for big data. Randomized SVD computes a near-optimal low-rank approximation much faster.
2.2 Algorithm
- Draw random projection matrix Ω∈Rn×(k+p)
- Compute Y=AΩ
- Compute QR factorization: Y=QR
- Project: B=QTA
- Compute SVD of small matrix B=UBΣBVBT
- Result: A≈(QUB)ΣBVBT
Python Implementation
pythonimport numpy as np def randomized_svd(A, k, p=5): n, m = A.shape Omega = np.random.randn(m, k + p) Y = A @ Omega Q, _ = np.linalg.qr(Y) B = Q.T @ A U_B, S, Vt = np.linalg.svd(B, full_matrices=False) U = Q @ U_B[:, :k] return U[:, :k], S[:k], Vt[:k, :] # Example A = np.random.randn(1000, 500) k = 10 U, S, Vt = randomized_svd(A, k) print(f"Original: {A.shape}, Compressed: {U.shape} x {S.shape}")
2.3 Error Bound
E[∣∣A−UkΣkVkT∣∣F]≤(1+p−1k)1/2∣∣A−Ak∣∣FWhere Ak is the optimal rank-k approximation and p is the oversampling parameter.
Join Discord
PreviousConcentration InequalitiesNextSpectral Graph Theory