Created
July 23, 2019 05:55
-
-
Save KhyatiMahendru/796099ca1361d681fff1576aa2b07fa3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.utils.extmath import randomized_svd | |
A = np.array([[-1, 2, 0], [2, 0, -2], [0, -2, 1]]) | |
u, s, vt = randomized_svd(A, n_components = 2) | |
print("Left Singular Vectors:") | |
print(u) | |
print("Singular Values:") | |
print(np.diag(s)) | |
print("Right Singular Vectors:") | |
print(vt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment