This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Read Sparse Matrix from text file to compute SVD

Tags: None
(comma "," separated)
ronakagrawal
Registered Member
Posts
5
Karma
0
Hi all

I have a large sparse matrix (
file format :txt
variable type:double,
row :15000 & column :100000
size 500 MB
)

Kindly guide me how to read a file and compute SVD, Reduced SVD from it.

More to that how is the SVD calculated? Is the entire matrix stored in RAM, or the algo calculates in chunk..
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
There is no sparse SVD algorithm in Eigen.
ronakagrawal
Registered Member
Posts
5
Karma
0
Hi

Thanks for response.
Can you suggest me better ways to calculate SVD of a sparse matrix

I used the following method:

1. Used #include <Eigen/Sparse> to fill the Sparse Matix
2 Computed SVD using http://eigen.tuxfamily.org/dox/classEig ... biSVD.html

It took 10 minutes to compute 9000 X 2000 matrix.
But Now I am unable to compute Reduced SVD using Eigen.

I used RedSVD - https://code.google.com/p/redsvd/wiki/English
Though it is fast I am not getting correct result :(

To read the data I used the Boost Library - http://stackoverflow.com/questions/1746 ... 2#17479702
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
How many singularvectors do you need? A trick to get RedSVD provides more accurate results is to let it computes many more singularvalues than what you actually need, and truncate them afterwards.
ronakagrawal
Registered Member
Posts
5
Karma
0
ggael wrote:How many singularvectors do you need? A trick to get RedSVD provides more accurate results is to let it computes many more singularvalues than what you
actually need, and truncate them afterwards.


Yes I am getting better result if i provide the exact number of singular vectors to retain.

I need SVD to carry dimensional reduction. I am using thumb rule to to retain enough singular values to make up 70% of the energy in Σ.
How should I modify the algorithm so that I can retain only top 70%

My aim is
1. Calculate K - So I can retain singular values upto 70%
2. Calculate Reduced SVD and obtain U,S,V
3. Multiply U,S,V to get a new matrix ( for dimensional reduction )


Assuming I need to read the sparse matrix from file , How should I implement this header file:
https://github.com/ntessore/redsvd-h/bl ... D/RedSVD-h

Should I use the boost library to read data from file and convert to Sparse Matrix or the RedSVD's header file


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]