|
Posted Monday, July 30, 2007 6:15 PM
|
|
|
|
Hello,
The documentation states:
The Singular Value Decomposition (SVD) of a mxn matrix A is written A = U*S*VH where S is an nxn (mxn if m<n) matrix which is zero except for its min(m,n) diagonal elements, U is an mxn (mxm if m<n) orthogonal/unitary matrix, and V is an nxn orthogonal/unitary matrix.
The diagonal elements of S are the singular values of A; they are real and non-negative, and are returned in descending order.
The first min(m,n) columns of U and V are the left and right singular vectors of A.
That is helpful for my case to reduce the dimensionality of A but would such a reordering not also change the order of the rows and columns of U and V and thus A? If so how would I know what changed?
Cheers,
reisender
|
|
Posted Wednesday, August 01, 2007 12:11 PM
|
|
|
|
Matrices U and V are returned already ordered to correspond with matrix S
Trifon Triantafillidis | Lead Developer |
|
|
|
Posted Wednesday, August 01, 2007 12:17 PM
|
|
|
|
Thanks for the reply. I assumed that U and V change according to S. My problem is that I for example associate words with each row (HAL/LSA) in A and save that in a separate index/list. After the SVD the rows (in U) would be shuffled and my index be invalid?! How would I know for example where row 1 from A moved in U? Maybe I am missing something here. Any help is appreciated.
Cheers,
reisender
|
|
Posted Friday, August 03, 2007 7:41 AM
|
|
|
|
I am not sure. Perhaps another forum member can help you with this. Guille perhaps, I think he is using NML for LSI.
Trifon Triantafillidis | Lead Developer |
|
|
|
Posted Friday, August 03, 2007 12:42 PM
|
|
|
|
| Hi to all The order of your list has the same order of U rows. When you get the U matrix and reduce it to your chosen number of dimentions and multiply it to reduced diagonal, the index of the rows are the same of your list index. I did the same as you, save the words in an array and the ocurrences in BML matrix like A. At the final, what you get in U´*D´ are the vectors that represents the words in the same order: Dim Descomposicion As SVD Descomposicion = New SVD(A, False) A.Dispose() A = Nothing ' ###Imagin I saved my words in the array WORDS and put the ocurrences in A in the same order. A(2,3) is the ocurrence of word(2) in the document 3. Dim Words() as string '########################and for example Mterms = Descomposicion.U.SubMatrix(0, Descomposicion.U.Rows - 1, 0, 300) 'in case of 300 dimentions DiagonalRed = Diagonal.SubMatrix(0, 300, 0, 300) MtermsRed = Mterms.Times(DiagonalReducida) ' ###you know that words(23) '###is represented by vector MtermsRed.Item(23) '###when you want to compare words by words, word(23) by words(45), you can calculate cosine among the vectors without problem MtermsRed.Item(23) MterminosRed.Item(45) please, let me know if I have Undertood you or it was another thing what you ask for. Guillermo de Jorge y botana (Guille)
|
|
Posted Friday, August 03, 2007 1:03 PM
|
|
|
|
| Sorry, there is an error in the argumentation: When: MtermsRed = Mterms.Times(DiagonalReducida) is MtermsRed = Mterms.Times(DiagonalRed)
|
|
Posted Tuesday, August 07, 2007 6:46 PM
|
|
|
|
Hi,
Thanks for the answer I think I figured it out now. As far as I can tell the order of the rows stays the same between A and U despite the descending order of S based on the columns of U being rearranged. This is a bit tricky to write in plain English but basically it works and nothing to worry 
Cheers,
reisender
|
|
|
|