Linear Algebra, Mathematics, Math, Principal Component, Python.
Approximation u, s, v = decomposition.randomized_svd(M, 1) u.shape, s.shape, v.shape ((4800, 1), (1,), (1, 11300)) low_rank = u @ np.diag(s) @ v low_rank.shape (4800, 11300) plt.figure(figsize=(12, 12)) plt.imshow(low_rank, cmap='gray') plt.imshow(np.reshape(M[:,550] - low_rank[:,550], dims),