on-internet
← Community

np.linalg.svd is giving me wrong results

Stack Overflow ·

I am trying to learn how SVD works to use it in PCA (principal component analysis), but the problem is that it seam I get wrong results, I tried using np.linalg.svd and this is my code: A = np.array([[2, 2], [1, 1]]) u, s, v = np.linalg.svd(A, full_matrices=False) print(u) print(s) print(v) And this is the result I got: [[-0.89442719 -0.4472136 ] [-0.4472136 0.89442719]] [3.16227766e+00 1.10062118e-17] [[-0.70710678 -0.70710678] [ 0.70710678 -0.70710678]] And I tried to get SVD decomposition on WolframAlpha and I got these results: The magnitude of values seems correct, but the sign is not cor

Comments

Sign in or sign up to comment and upvote.

No comments yet.