Questions tagged [svd]

Singular Value Decomposition (SVD) is a factorization of a real or complex matrix, with many useful applications in signal processing and statistics.

The Singular Value Decomposition (SVD) of a rectangular matrix A is a decomposition of the form:

A = U S V*

where U and V are orthogonal matrices, and S is a diagonal matrix containing the singular values.

In scientific software for statistical computing, function svd computes this decomposition.

746 questions
91
votes
2 answers

cocktail party algorithm SVD implementation ... in one line of code?

In a slide within the introductory lecture on machine learning by Stanford's Andrew Ng at Coursera, he gives the following one line Octave solution to the cocktail party problem given the audio sources are recorded by two spatially separated…
gregS
  • 2,580
  • 5
  • 28
  • 33
50
votes
6 answers

How many principal components to take?

I know that principal component analysis does a SVD on a matrix and then generates an eigen value matrix. To select the principal components we have to take only the first few eigen values. Now, how do we decide on the number of eigen values that we…
London guy
  • 27,522
  • 44
  • 121
  • 179
38
votes
3 answers

importance of PCA or SVD in machine learning

All this time (specially in Netflix contest), I always come across this blog (or leaderboard forum) where they mention how by applying a simple SVD step on data helped them in reducing sparsity in data or in general improved the performance of their…
frazman
  • 32,081
  • 75
  • 184
  • 269
38
votes
6 answers

Python (NumPy, SciPy), finding the null space of a matrix

I'm trying to find the null space (solution space of Ax=0) of a given matrix. I've found two examples, but I can't seem to get either to work. Moreover, I can't understand what they're doing to get there, so I can't debug. I'm hoping someone might…
Nona Urbiz
  • 4,873
  • 16
  • 57
  • 84
38
votes
7 answers

Get U, Sigma, V* matrix from Truncated SVD in scikit-learn

I am using truncated SVD from scikit-learn package. In the definition of SVD, an original matrix A is approxmated as a product A ≈ UΣV* where U and V have orthonormal columns, and Σ is non-negative diagonal. I need to get the U, Σ and V* matrices.…
Vektor88
  • 4,841
  • 11
  • 59
  • 111
34
votes
5 answers

What is SVD(singular value decomposition)

How does it actually reduce noise..can you suggest some nice tutorials?
shiva
24
votes
2 answers

Performing PCA on large sparse matrix by using sklearn

I am trying to apply PCA on huge sparse matrix, in the following link it says that randomizedPCA of sklearn can handle sparse matrix of scipy sparse format. Apply PCA on very large sparse matrix However, I always get error. Can someone point out…
khassan
  • 349
  • 1
  • 2
  • 5
17
votes
3 answers

SciPy SVD vs. Numpy SVD

Both SciPy and Numpy have built in functions for singular value decomposition (SVD). The commands are basically scipy.linalg.svd and numpy.linalg.svd. What is the difference between these two? Is any of them better than the other one?
A.M.
  • 1,757
  • 5
  • 22
  • 41
16
votes
1 answer

Eigenvectors computed with numpy's eigh and svd do not match

Consider singular value decomposition M=USV*. Then the eigenvalue decomposition of M* M gives M* M= V (S* S) V*=VS* U* USV*. I wish to verify this equality with numpy by showing that the eigenvectors returned by eigh function are the same as those…
matus
  • 275
  • 2
  • 9
16
votes
4 answers

Using SVD to compress an image in MATLAB

I am brand new to MATLAB but am trying to do some image compression code for grayscale images. Questions How can I use SVD to trim off low-valued eigenvalues to reconstruct a compressed image? Work/Attempts so far My code so far…
Justin
  • 263
  • 1
  • 2
  • 7
15
votes
3 answers

SVD computing different result in Matlab and OpenCV

I wonder why there is sign difference in result for SVD computing in Matlab and OpenCV. I input the same matrix 3.65E+06 -2.09E+06 0 YY = -2.09E+06 2.45E+06 0 0 0 0 [U,S,V] = svd(YY);//Matlab …
Bryanyan
  • 677
  • 3
  • 13
  • 30
12
votes
1 answer

scikit-learn TruncatedSVD's explained variance ratio not in descending order

The TruncatedSVD's explained variance ratio is not in descending order, unlike sklearn's PCA. I looked at the source code and it seems they use different way of calculating the explained variance ratio: TruncatedSVD: U, Sigma, VT = randomized_svd(X,…
Xiangyu
  • 824
  • 9
  • 34
12
votes
2 answers

Calculating the null space of a matrix

I'm attempting to solve a set of equations of the form Ax = 0. A is known 6x6 matrix and I've written the below code using SVD to get the vector x which works to a certain extent. The answer is approximately correct but not good enough to be useful…
Ainsworth
  • 123
  • 1
  • 4
12
votes
0 answers

python scipy sparse matrix SVD with error ARPACK error 3: No shifts could be applied during a cycle of the Implicitly restarted Arnoldi iteration

I was using scipy to do sparse matrix svd on some large data. The matix is around 200,000*8,000,000 size, with 1.19% non-zero entries. The machine I was using has 160G memory so i suppose memory shouldn't be an issue. So here is some code i…
youwillwin
  • 121
  • 1
  • 4
11
votes
1 answer

Compute projection / hat matrix via QR factorization, SVD (and Cholesky factorization?)

I'm trying to calculate in R a projection matrix P of an arbitrary N x J matrix S: P = S (S'S) ^ -1 S' I've been trying to perform this with the following function: P <- function(S){ output <- S %*% solve(t(S) %*% S) %*% t(S) …
bikeclub
  • 369
  • 2
  • 10
1
2 3
49 50