You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Aniruddha Basak <t-...@expedia.com> on 2012/07/20 03:12:56 UTC

eigendecomposition of very large matrices

Hi,
I am working on a clustering problem which involves determining the
largest "k" eigenvectors of a very large matrix. The matrices, I work on,
are typically of the order of 10^6 by 10^6.
Trying to do this using the Lanczos solver available in Mahout, I found it
is very slow and takes around 1.5 minutes to compute each eigenvectors.
Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!

So I am looking for something faster to solve the "Eigen decomposition"
problem for very large sparse matrix. Please suggest me what should I use ?


Thanks,
Aniruddha


RE: eigendecomposition of very large matrices

Posted by Aniruddha Basak <t-...@expedia.com>.
Hi Dan,
Which files are you looking for ?
Are not they present in <output_dir>/calculations/ ?


Aniruddha


-----Original Message-----
From: Dan Brickley [mailto:danbri@danbri.org] 
Sent: Thursday, July 26, 2012 2:35 PM
To: user@mahout.apache.org
Cc: user@mahout.apache.org
Subject: Re: eigendecomposition of very large matrices


On 26 Jul 2012, at 21:12, Aniruddha Basak <t-...@expedia.com> wrote:

> Hi,
> I am trying to use SSVD instead of Lanczos, as a part of Spectral Kmeans. 

I started looking at this. I wanted to find a way to recycle the existing first steps of the spectralkmeans code, at least as far as generating the laplacian re-representation of the affinity matrix. I thought we could persuade it not to clean/delete the intermediate working files...

How are you approaching this?

Dan

> However, I could not find the relation between the eigenvectors and U, V matrices.
> Can someone please tell me, how to retrieve the eigenvectors from SSVD decomposition ?
> 
> Thanks,
> Aniruddha
> 
> 
> 
> -----Original Message-----
> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> Sent: Thursday, July 19, 2012 10:53 PM
> To: user@mahout.apache.org
> Subject: RE: eigendecomposition of very large matrices
> 
> Pps if you do insist on having a lot of k then you'll benefit from smaller hdfs block size, not larger.
> On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:
> 
>> Yeah I see OK. Both two experiments conducted with mahout ssvd I am 
>> familiar with dealt with input size greater than yours element wise, 
>> on a quite modest node count. So i don't think your input size will 
>> be a problem. But the number of singular values will be.
>> 
>> But I doubt any input will yield anything useful beyond k=200 but 
>> statistical noise. Even if you have a good decay of the singular values.
>> But I bet you don't need that many. You can fit significantly more 
>> 'clusters' on a 'fairly small' dimensional space.
>> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:
>> 
>>> Thanks Dmitriy for your reply.
>>> The matrix I am working on, has 10-20 non zero entries per row. So 
>>> its very sparse.
>>> I am trying to do spectral clustering which involves eigen-decomposition.
>>> I am wondering whether anyone has tried to do spectral clustering 
>>> using mahout for very large affinity matrix (input).
>>> 
>>> Aniruddha
>>> 
>>> 
>>> -----Original Message-----
>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>> Sent: Thursday, July 19, 2012 6:28 PM
>>> To: user@mahout.apache.org
>>> Subject: Re: eigendecomposition of very large matrices
>>> 
>>> very significant sparsity may be a problem though for -q >=1 parameters.
>>> Again, depends on the hardware you have and the # of non-zero 
>>> elements in the input. but -q=1 is still the most recommended setting here.
>>> 
>>> 
>>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov 
>>> <dl...@gmail.com>
>>> wrote:
>>>> you may try SSVD.
>>>> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singu
>>>> lar
>>>> +Value+Decomposition
>>>> 
>>>> but 4k eigenvectors (or, rather, singular values) is kind of still 
>>>> a lot though and may push the precision out of the error estimates.
>>>> I don't we had precision study for that many. Also need quite a bit 
>>>> of memory to compute that (not to mention flops). More 
>>>> realistically you probably may try 1k singular values . You may try 
>>>> more if you have access to more powerful hardware than we did in 
>>>> the studies but distributed computation time will grow at about 
>>>> k^1.5, i.e. faster than linear, even if you have enough nodes for the tasks.
>>>> 
>>>> -d
>>>> 
>>>> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak 
>>>> <t-...@expedia.com>
>>> wrote:
>>>>> Hi,
>>>>> I am working on a clustering problem which involves determining 
>>>>> the largest "k" eigenvectors of a very large matrix. The matrices, 
>>>>> I work on, are typically of the order of 10^6 by 10^6.
>>>>> Trying to do this using the Lanczos solver available in Mahout, I 
>>>>> found it is very slow and takes around 1.5 minutes to compute each
>>> eigenvectors.
>>>>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>>>> 
>>>>> So I am looking for something faster to solve the "Eigen decomposition"
>>>>> problem for very large sparse matrix. Please suggest me what 
>>>>> should I
>>> use ?
>>>>> 
>>>>> 
>>>>> Thanks,
>>>>> Aniruddha
>>>>> 
>>> 
>> 

Re: eigendecomposition of very large matrices

Posted by Dan Brickley <da...@danbri.org>.
On 26 Jul 2012, at 21:12, Aniruddha Basak <t-...@expedia.com> wrote:

> Hi,
> I am trying to use SSVD instead of Lanczos, as a part of Spectral Kmeans. 

I started looking at this. I wanted to find a way to recycle the existing first steps of the spectralkmeans code, at least as far as generating the laplacian re-representation of the affinity matrix. I thought we could persuade it not to clean/delete the intermediate working files...

How are you approaching this?

Dan

> However, I could not find the relation between the eigenvectors and U, V matrices.
> Can someone please tell me, how to retrieve the eigenvectors from SSVD decomposition ?
> 
> Thanks,
> Aniruddha
> 
> 
> 
> -----Original Message-----
> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com] 
> Sent: Thursday, July 19, 2012 10:53 PM
> To: user@mahout.apache.org
> Subject: RE: eigendecomposition of very large matrices
> 
> Pps if you do insist on having a lot of k then you'll benefit from smaller hdfs block size, not larger.
> On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:
> 
>> Yeah I see OK. Both two experiments conducted with mahout ssvd I am 
>> familiar with dealt with input size greater than yours element wise, 
>> on a quite modest node count. So i don't think your input size will be 
>> a problem. But the number of singular values will be.
>> 
>> But I doubt any input will yield anything useful beyond k=200 but 
>> statistical noise. Even if you have a good decay of the singular values.
>> But I bet you don't need that many. You can fit significantly more 
>> 'clusters' on a 'fairly small' dimensional space.
>> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:
>> 
>>> Thanks Dmitriy for your reply.
>>> The matrix I am working on, has 10-20 non zero entries per row. So 
>>> its very sparse.
>>> I am trying to do spectral clustering which involves eigen-decomposition.
>>> I am wondering whether anyone has tried to do spectral clustering 
>>> using mahout for very large affinity matrix (input).
>>> 
>>> Aniruddha
>>> 
>>> 
>>> -----Original Message-----
>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>> Sent: Thursday, July 19, 2012 6:28 PM
>>> To: user@mahout.apache.org
>>> Subject: Re: eigendecomposition of very large matrices
>>> 
>>> very significant sparsity may be a problem though for -q >=1 parameters.
>>> Again, depends on the hardware you have and the # of non-zero 
>>> elements in the input. but -q=1 is still the most recommended setting here.
>>> 
>>> 
>>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov <dl...@gmail.com>
>>> wrote:
>>>> you may try SSVD.
>>>> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singu
>>>> lar
>>>> +Value+Decomposition
>>>> 
>>>> but 4k eigenvectors (or, rather, singular values) is kind of still 
>>>> a lot though and may push the precision out of the error estimates. 
>>>> I don't we had precision study for that many. Also need quite a bit 
>>>> of memory to compute that (not to mention flops). More 
>>>> realistically you probably may try 1k singular values . You may try 
>>>> more if you have access to more powerful hardware than we did in 
>>>> the studies but distributed computation time will grow at about 
>>>> k^1.5, i.e. faster than linear, even if you have enough nodes for the tasks.
>>>> 
>>>> -d
>>>> 
>>>> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak 
>>>> <t-...@expedia.com>
>>> wrote:
>>>>> Hi,
>>>>> I am working on a clustering problem which involves determining 
>>>>> the largest "k" eigenvectors of a very large matrix. The matrices, 
>>>>> I work on, are typically of the order of 10^6 by 10^6.
>>>>> Trying to do this using the Lanczos solver available in Mahout, I 
>>>>> found it is very slow and takes around 1.5 minutes to compute each
>>> eigenvectors.
>>>>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>>>> 
>>>>> So I am looking for something faster to solve the "Eigen decomposition"
>>>>> problem for very large sparse matrix. Please suggest me what 
>>>>> should I
>>> use ?
>>>>> 
>>>>> 
>>>>> Thanks,
>>>>> Aniruddha
>>>>> 
>>> 
>> 

Re: eigendecomposition of very large matrices

Posted by Ted Dunning <te...@gmail.com>.
The algorithm used doesn't change this.  If U S V' = A is the SVD of A, then

   A' A = (U S V')' U S V'
          = V S U' U S V'
          = V S^2 V'



On Thu, Jul 26, 2012 at 4:31 PM, John Stewart <jd...@wgen.net> wrote:

> With Lanczos, the eigenvectors of A'A give you the orthogonal matrix V of
> SVD, and the eigenvalues give you the singular values (usually named as
> Sigma or S).  To get U you then back multiply: U = AV(S^-1)
>
> jds
>
> On 7/26/12 5:32 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:
>
> >wikipedia article implies that if A is positive definite (and normal
> >which is true for symmetric) then SVD is the same as
> >eigendecomposition.
> >
> >however being positive definite is a fairly strong requirement...
> >
> >On Thu, Jul 26, 2012 at 2:06 PM, Aniruddha Basak <t-...@expedia.com>
> >wrote:
> >> If A is symmetric, I observe from small tests in Matlab, the eigenvalues
> >> and singular values are same (might not always be true) in magnitude.
> >> Similarly eigenvectors and columns of V are same but some have opposite
> >>sign.
> >>
> >> Now, there are two questions,
> >> 1. How to retrieve eigenvectors with correct sign from U or V?
> >> 2. If we ignore this difference, and perform the next steps of spectral
> >>kmeans, will the results be correct?
> >>
> >>
> >> Aniruddha
> >>
> >>
> >> -----Original Message-----
> >> From: Dan Brickley [mailto:danbri@danbri.org]
> >> Sent: Thursday, July 26, 2012 1:56 PM
> >> To: user@mahout.apache.org
> >> Cc: user@mahout.apache.org
> >> Subject: Re: eigendecomposition of very large matrices
> >>
> >>
> >>
> >>
> >>
> >> On 26 Jul 2012, at 21:21, Aniruddha Basak <t-...@expedia.com> wrote:
> >>
> >>> Actually that's my confusion. I don't need the eigenvectors of AA'
> >>> but of A !
> >>> If I can find a matrix B such that BB'=A, then from the SVD
> >>> decomposition of B we can get the eigenvectors of A. But how to get B
> >>>in that case ?
> >>
> >> Does it help us if A is symmetric?
> >>
> >> Dan
> >>
> >>>
> >>> Aniruddha
> >>>
> >>>
> >>> -----Original Message-----
> >>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> >>> Sent: Thursday, July 26, 2012 1:18 PM
> >>> To: user@mahout.apache.org
> >>> Subject: Re: eigendecomposition of very large matrices
> >>>
> >>> See http://en.wikipedia.org/wiki/Singular_value_decomposition,
> >>> "relation to eigenvalue decomposition".
> >>>
> >>> Depending on what you consider source for the eigendecompostion, AA'
> >>> or A'A, the eigenvectors would be column vectors of U or V
> >>>respectively.
> >>>
> >>> On Thu, Jul 26, 2012 at 1:12 PM, Aniruddha Basak
> >>><t-...@expedia.com> wrote:
> >>>> Hi,
> >>>> I am trying to use SSVD instead of Lanczos, as a part of Spectral
> >>>>Kmeans.
> >>>> However, I could not find the relation between the eigenvectors and
> >>>>U, V matrices.
> >>>> Can someone please tell me, how to retrieve the eigenvectors from
> >>>>SSVD decomposition ?
> >>>>
> >>>> Thanks,
> >>>> Aniruddha
> >>>>
> >>>>
> >>>>
> >>>> -----Original Message-----
> >>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> >>>> Sent: Thursday, July 19, 2012 10:53 PM
> >>>> To: user@mahout.apache.org
> >>>> Subject: RE: eigendecomposition of very large matrices
> >>>>
> >>>> Pps if you do insist on having a lot of k then you'll benefit from
> >>>>smaller hdfs block size, not larger.
> >>>> On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com>
> >>>>wrote:
> >>>>
> >>>>> Yeah I see OK. Both two experiments conducted with mahout ssvd I am
> >>>>> familiar with dealt with input size greater than yours element wise,
> >>>>> on a quite modest node count. So i don't think your input size will
> >>>>> be a problem. But the number of singular values will be.
> >>>>>
> >>>>> But I doubt any input will yield anything useful beyond k=200 but
> >>>>> statistical noise. Even if you have a good decay of the singular
> >>>>>values.
> >>>>> But I bet you don't need that many. You can fit significantly more
> >>>>> 'clusters' on a 'fairly small' dimensional space.
> >>>>> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com>
> >>>>>wrote:
> >>>>>
> >>>>>> Thanks Dmitriy for your reply.
> >>>>>> The matrix I am working on, has 10-20 non zero entries per row. So
> >>>>>> its very sparse.
> >>>>>> I am trying to do spectral clustering which involves
> >>>>>>eigen-decomposition.
> >>>>>> I am wondering whether anyone has tried to do spectral clustering
> >>>>>> using mahout for very large affinity matrix (input).
> >>>>>>
> >>>>>> Aniruddha
> >>>>>>
> >>>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> >>>>>> Sent: Thursday, July 19, 2012 6:28 PM
> >>>>>> To: user@mahout.apache.org
> >>>>>> Subject: Re: eigendecomposition of very large matrices
> >>>>>>
> >>>>>> very significant sparsity may be a problem though for -q >=1
> >>>>>>parameters.
> >>>>>> Again, depends on the hardware you have and the # of non-zero
> >>>>>> elements in the input. but -q=1 is still the most recommended
> >>>>>>setting here.
> >>>>>>
> >>>>>>
> >>>>>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov
> >>>>>> <dl...@gmail.com>
> >>>>>> wrote:
> >>>>>>> you may try SSVD.
> >>>>>>> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Sing
> >>>>>>> u
> >>>>>>> lar
> >>>>>>> +Value+Decomposition
> >>>>>>>
> >>>>>>> but 4k eigenvectors (or, rather, singular values) is kind of still
> >>>>>>> a lot though and may push the precision out of the error estimates.
> >>>>>>> I don't we had precision study for that many. Also need quite a
> >>>>>>> bit of memory to compute that (not to mention flops). More
> >>>>>>> realistically you probably may try 1k singular values . You may
> >>>>>>> try more if you have access to more powerful hardware than we did
> >>>>>>> in the studies but distributed computation time will grow at about
> >>>>>>> k^1.5, i.e. faster than linear, even if you have enough nodes for
> >>>>>>>the tasks.
> >>>>>>>
> >>>>>>> -d
> >>>>>>>
> >>>>>>> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak
> >>>>>>> <t-...@expedia.com>
> >>>>>> wrote:
> >>>>>>>> Hi,
> >>>>>>>> I am working on a clustering problem which involves determining
> >>>>>>>> the largest "k" eigenvectors of a very large matrix. The
> >>>>>>>> matrices, I work on, are typically of the order of 10^6 by 10^6.
> >>>>>>>> Trying to do this using the Lanczos solver available in Mahout, I
> >>>>>>>> found it is very slow and takes around 1.5 minutes to compute
> >>>>>>>> each
> >>>>>> eigenvectors.
> >>>>>>>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
> >>>>>>>>
> >>>>>>>> So I am looking for something faster to solve the "Eigen
> >>>>>>>>decomposition"
> >>>>>>>> problem for very large sparse matrix. Please suggest me what
> >>>>>>>> should I
> >>>>>> use ?
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> Thanks,
> >>>>>>>> Aniruddha
> >>>>>>>>
> >>>>>>
> >>>>>
>
>

Re: eigendecomposition of very large matrices

Posted by John Stewart <jd...@wgen.net>.
With Lanczos, the eigenvectors of A'A give you the orthogonal matrix V of
SVD, and the eigenvalues give you the singular values (usually named as
Sigma or S).  To get U you then back multiply: U = AV(S^-1)

jds

On 7/26/12 5:32 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:

>wikipedia article implies that if A is positive definite (and normal
>which is true for symmetric) then SVD is the same as
>eigendecomposition.
>
>however being positive definite is a fairly strong requirement...
>
>On Thu, Jul 26, 2012 at 2:06 PM, Aniruddha Basak <t-...@expedia.com>
>wrote:
>> If A is symmetric, I observe from small tests in Matlab, the eigenvalues
>> and singular values are same (might not always be true) in magnitude.
>> Similarly eigenvectors and columns of V are same but some have opposite
>>sign.
>>
>> Now, there are two questions,
>> 1. How to retrieve eigenvectors with correct sign from U or V?
>> 2. If we ignore this difference, and perform the next steps of spectral
>>kmeans, will the results be correct?
>>
>>
>> Aniruddha
>>
>>
>> -----Original Message-----
>> From: Dan Brickley [mailto:danbri@danbri.org]
>> Sent: Thursday, July 26, 2012 1:56 PM
>> To: user@mahout.apache.org
>> Cc: user@mahout.apache.org
>> Subject: Re: eigendecomposition of very large matrices
>>
>>
>>
>>
>>
>> On 26 Jul 2012, at 21:21, Aniruddha Basak <t-...@expedia.com> wrote:
>>
>>> Actually that's my confusion. I don't need the eigenvectors of AA'
>>> but of A !
>>> If I can find a matrix B such that BB'=A, then from the SVD
>>> decomposition of B we can get the eigenvectors of A. But how to get B
>>>in that case ?
>>
>> Does it help us if A is symmetric?
>>
>> Dan
>>
>>>
>>> Aniruddha
>>>
>>>
>>> -----Original Message-----
>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>> Sent: Thursday, July 26, 2012 1:18 PM
>>> To: user@mahout.apache.org
>>> Subject: Re: eigendecomposition of very large matrices
>>>
>>> See http://en.wikipedia.org/wiki/Singular_value_decomposition,
>>> "relation to eigenvalue decomposition".
>>>
>>> Depending on what you consider source for the eigendecompostion, AA'
>>> or A'A, the eigenvectors would be column vectors of U or V
>>>respectively.
>>>
>>> On Thu, Jul 26, 2012 at 1:12 PM, Aniruddha Basak
>>><t-...@expedia.com> wrote:
>>>> Hi,
>>>> I am trying to use SSVD instead of Lanczos, as a part of Spectral
>>>>Kmeans.
>>>> However, I could not find the relation between the eigenvectors and
>>>>U, V matrices.
>>>> Can someone please tell me, how to retrieve the eigenvectors from
>>>>SSVD decomposition ?
>>>>
>>>> Thanks,
>>>> Aniruddha
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>>> Sent: Thursday, July 19, 2012 10:53 PM
>>>> To: user@mahout.apache.org
>>>> Subject: RE: eigendecomposition of very large matrices
>>>>
>>>> Pps if you do insist on having a lot of k then you'll benefit from
>>>>smaller hdfs block size, not larger.
>>>> On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com>
>>>>wrote:
>>>>
>>>>> Yeah I see OK. Both two experiments conducted with mahout ssvd I am
>>>>> familiar with dealt with input size greater than yours element wise,
>>>>> on a quite modest node count. So i don't think your input size will
>>>>> be a problem. But the number of singular values will be.
>>>>>
>>>>> But I doubt any input will yield anything useful beyond k=200 but
>>>>> statistical noise. Even if you have a good decay of the singular
>>>>>values.
>>>>> But I bet you don't need that many. You can fit significantly more
>>>>> 'clusters' on a 'fairly small' dimensional space.
>>>>> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com>
>>>>>wrote:
>>>>>
>>>>>> Thanks Dmitriy for your reply.
>>>>>> The matrix I am working on, has 10-20 non zero entries per row. So
>>>>>> its very sparse.
>>>>>> I am trying to do spectral clustering which involves
>>>>>>eigen-decomposition.
>>>>>> I am wondering whether anyone has tried to do spectral clustering
>>>>>> using mahout for very large affinity matrix (input).
>>>>>>
>>>>>> Aniruddha
>>>>>>
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>>>>> Sent: Thursday, July 19, 2012 6:28 PM
>>>>>> To: user@mahout.apache.org
>>>>>> Subject: Re: eigendecomposition of very large matrices
>>>>>>
>>>>>> very significant sparsity may be a problem though for -q >=1
>>>>>>parameters.
>>>>>> Again, depends on the hardware you have and the # of non-zero
>>>>>> elements in the input. but -q=1 is still the most recommended
>>>>>>setting here.
>>>>>>
>>>>>>
>>>>>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov
>>>>>> <dl...@gmail.com>
>>>>>> wrote:
>>>>>>> you may try SSVD.
>>>>>>> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Sing
>>>>>>> u
>>>>>>> lar
>>>>>>> +Value+Decomposition
>>>>>>>
>>>>>>> but 4k eigenvectors (or, rather, singular values) is kind of still
>>>>>>> a lot though and may push the precision out of the error estimates.
>>>>>>> I don't we had precision study for that many. Also need quite a
>>>>>>> bit of memory to compute that (not to mention flops). More
>>>>>>> realistically you probably may try 1k singular values . You may
>>>>>>> try more if you have access to more powerful hardware than we did
>>>>>>> in the studies but distributed computation time will grow at about
>>>>>>> k^1.5, i.e. faster than linear, even if you have enough nodes for
>>>>>>>the tasks.
>>>>>>>
>>>>>>> -d
>>>>>>>
>>>>>>> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak
>>>>>>> <t-...@expedia.com>
>>>>>> wrote:
>>>>>>>> Hi,
>>>>>>>> I am working on a clustering problem which involves determining
>>>>>>>> the largest "k" eigenvectors of a very large matrix. The
>>>>>>>> matrices, I work on, are typically of the order of 10^6 by 10^6.
>>>>>>>> Trying to do this using the Lanczos solver available in Mahout, I
>>>>>>>> found it is very slow and takes around 1.5 minutes to compute
>>>>>>>> each
>>>>>> eigenvectors.
>>>>>>>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>>>>>>>
>>>>>>>> So I am looking for something faster to solve the "Eigen
>>>>>>>>decomposition"
>>>>>>>> problem for very large sparse matrix. Please suggest me what
>>>>>>>> should I
>>>>>> use ?
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Aniruddha
>>>>>>>>
>>>>>>
>>>>>


Re: eigendecomposition of very large matrices

Posted by Dmitriy Lyubimov <dl...@gmail.com>.
wikipedia article implies that if A is positive definite (and normal
which is true for symmetric) then SVD is the same as
eigendecomposition.

however being positive definite is a fairly strong requirement...

On Thu, Jul 26, 2012 at 2:06 PM, Aniruddha Basak <t-...@expedia.com> wrote:
> If A is symmetric, I observe from small tests in Matlab, the eigenvalues
> and singular values are same (might not always be true) in magnitude.
> Similarly eigenvectors and columns of V are same but some have opposite sign.
>
> Now, there are two questions,
> 1. How to retrieve eigenvectors with correct sign from U or V?
> 2. If we ignore this difference, and perform the next steps of spectral kmeans, will the results be correct?
>
>
> Aniruddha
>
>
> -----Original Message-----
> From: Dan Brickley [mailto:danbri@danbri.org]
> Sent: Thursday, July 26, 2012 1:56 PM
> To: user@mahout.apache.org
> Cc: user@mahout.apache.org
> Subject: Re: eigendecomposition of very large matrices
>
>
>
>
>
> On 26 Jul 2012, at 21:21, Aniruddha Basak <t-...@expedia.com> wrote:
>
>> Actually that's my confusion. I don't need the eigenvectors of AA'
>> but of A !
>> If I can find a matrix B such that BB'=A, then from the SVD
>> decomposition of B we can get the eigenvectors of A. But how to get B in that case ?
>
> Does it help us if A is symmetric?
>
> Dan
>
>>
>> Aniruddha
>>
>>
>> -----Original Message-----
>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>> Sent: Thursday, July 26, 2012 1:18 PM
>> To: user@mahout.apache.org
>> Subject: Re: eigendecomposition of very large matrices
>>
>> See http://en.wikipedia.org/wiki/Singular_value_decomposition,
>> "relation to eigenvalue decomposition".
>>
>> Depending on what you consider source for the eigendecompostion, AA'
>> or A'A, the eigenvectors would be column vectors of U or V respectively.
>>
>> On Thu, Jul 26, 2012 at 1:12 PM, Aniruddha Basak <t-...@expedia.com> wrote:
>>> Hi,
>>> I am trying to use SSVD instead of Lanczos, as a part of Spectral Kmeans.
>>> However, I could not find the relation between the eigenvectors and U, V matrices.
>>> Can someone please tell me, how to retrieve the eigenvectors from SSVD decomposition ?
>>>
>>> Thanks,
>>> Aniruddha
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>> Sent: Thursday, July 19, 2012 10:53 PM
>>> To: user@mahout.apache.org
>>> Subject: RE: eigendecomposition of very large matrices
>>>
>>> Pps if you do insist on having a lot of k then you'll benefit from smaller hdfs block size, not larger.
>>> On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:
>>>
>>>> Yeah I see OK. Both two experiments conducted with mahout ssvd I am
>>>> familiar with dealt with input size greater than yours element wise,
>>>> on a quite modest node count. So i don't think your input size will
>>>> be a problem. But the number of singular values will be.
>>>>
>>>> But I doubt any input will yield anything useful beyond k=200 but
>>>> statistical noise. Even if you have a good decay of the singular values.
>>>> But I bet you don't need that many. You can fit significantly more
>>>> 'clusters' on a 'fairly small' dimensional space.
>>>> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:
>>>>
>>>>> Thanks Dmitriy for your reply.
>>>>> The matrix I am working on, has 10-20 non zero entries per row. So
>>>>> its very sparse.
>>>>> I am trying to do spectral clustering which involves eigen-decomposition.
>>>>> I am wondering whether anyone has tried to do spectral clustering
>>>>> using mahout for very large affinity matrix (input).
>>>>>
>>>>> Aniruddha
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>>>> Sent: Thursday, July 19, 2012 6:28 PM
>>>>> To: user@mahout.apache.org
>>>>> Subject: Re: eigendecomposition of very large matrices
>>>>>
>>>>> very significant sparsity may be a problem though for -q >=1 parameters.
>>>>> Again, depends on the hardware you have and the # of non-zero
>>>>> elements in the input. but -q=1 is still the most recommended setting here.
>>>>>
>>>>>
>>>>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov
>>>>> <dl...@gmail.com>
>>>>> wrote:
>>>>>> you may try SSVD.
>>>>>> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Sing
>>>>>> u
>>>>>> lar
>>>>>> +Value+Decomposition
>>>>>>
>>>>>> but 4k eigenvectors (or, rather, singular values) is kind of still
>>>>>> a lot though and may push the precision out of the error estimates.
>>>>>> I don't we had precision study for that many. Also need quite a
>>>>>> bit of memory to compute that (not to mention flops). More
>>>>>> realistically you probably may try 1k singular values . You may
>>>>>> try more if you have access to more powerful hardware than we did
>>>>>> in the studies but distributed computation time will grow at about
>>>>>> k^1.5, i.e. faster than linear, even if you have enough nodes for the tasks.
>>>>>>
>>>>>> -d
>>>>>>
>>>>>> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak
>>>>>> <t-...@expedia.com>
>>>>> wrote:
>>>>>>> Hi,
>>>>>>> I am working on a clustering problem which involves determining
>>>>>>> the largest "k" eigenvectors of a very large matrix. The
>>>>>>> matrices, I work on, are typically of the order of 10^6 by 10^6.
>>>>>>> Trying to do this using the Lanczos solver available in Mahout, I
>>>>>>> found it is very slow and takes around 1.5 minutes to compute
>>>>>>> each
>>>>> eigenvectors.
>>>>>>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>>>>>>
>>>>>>> So I am looking for something faster to solve the "Eigen decomposition"
>>>>>>> problem for very large sparse matrix. Please suggest me what
>>>>>>> should I
>>>>> use ?
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Aniruddha
>>>>>>>
>>>>>
>>>>

RE: eigendecomposition of very large matrices

Posted by Aniruddha Basak <t-...@expedia.com>.
If A is symmetric, I observe from small tests in Matlab, the eigenvalues
and singular values are same (might not always be true) in magnitude.
Similarly eigenvectors and columns of V are same but some have opposite sign.

Now, there are two questions,
1. How to retrieve eigenvectors with correct sign from U or V?
2. If we ignore this difference, and perform the next steps of spectral kmeans, will the results be correct?


Aniruddha


-----Original Message-----
From: Dan Brickley [mailto:danbri@danbri.org] 
Sent: Thursday, July 26, 2012 1:56 PM
To: user@mahout.apache.org
Cc: user@mahout.apache.org
Subject: Re: eigendecomposition of very large matrices





On 26 Jul 2012, at 21:21, Aniruddha Basak <t-...@expedia.com> wrote:

> Actually that's my confusion. I don't need the eigenvectors of AA'
> but of A ! 
> If I can find a matrix B such that BB'=A, then from the SVD 
> decomposition of B we can get the eigenvectors of A. But how to get B in that case ?

Does it help us if A is symmetric?

Dan

> 
> Aniruddha
> 
> 
> -----Original Message-----
> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> Sent: Thursday, July 26, 2012 1:18 PM
> To: user@mahout.apache.org
> Subject: Re: eigendecomposition of very large matrices
> 
> See http://en.wikipedia.org/wiki/Singular_value_decomposition,
> "relation to eigenvalue decomposition".
> 
> Depending on what you consider source for the eigendecompostion, AA'
> or A'A, the eigenvectors would be column vectors of U or V respectively.
> 
> On Thu, Jul 26, 2012 at 1:12 PM, Aniruddha Basak <t-...@expedia.com> wrote:
>> Hi,
>> I am trying to use SSVD instead of Lanczos, as a part of Spectral Kmeans.
>> However, I could not find the relation between the eigenvectors and U, V matrices.
>> Can someone please tell me, how to retrieve the eigenvectors from SSVD decomposition ?
>> 
>> Thanks,
>> Aniruddha
>> 
>> 
>> 
>> -----Original Message-----
>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>> Sent: Thursday, July 19, 2012 10:53 PM
>> To: user@mahout.apache.org
>> Subject: RE: eigendecomposition of very large matrices
>> 
>> Pps if you do insist on having a lot of k then you'll benefit from smaller hdfs block size, not larger.
>> On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:
>> 
>>> Yeah I see OK. Both two experiments conducted with mahout ssvd I am 
>>> familiar with dealt with input size greater than yours element wise, 
>>> on a quite modest node count. So i don't think your input size will 
>>> be a problem. But the number of singular values will be.
>>> 
>>> But I doubt any input will yield anything useful beyond k=200 but 
>>> statistical noise. Even if you have a good decay of the singular values.
>>> But I bet you don't need that many. You can fit significantly more 
>>> 'clusters' on a 'fairly small' dimensional space.
>>> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:
>>> 
>>>> Thanks Dmitriy for your reply.
>>>> The matrix I am working on, has 10-20 non zero entries per row. So 
>>>> its very sparse.
>>>> I am trying to do spectral clustering which involves eigen-decomposition.
>>>> I am wondering whether anyone has tried to do spectral clustering 
>>>> using mahout for very large affinity matrix (input).
>>>> 
>>>> Aniruddha
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>>> Sent: Thursday, July 19, 2012 6:28 PM
>>>> To: user@mahout.apache.org
>>>> Subject: Re: eigendecomposition of very large matrices
>>>> 
>>>> very significant sparsity may be a problem though for -q >=1 parameters.
>>>> Again, depends on the hardware you have and the # of non-zero 
>>>> elements in the input. but -q=1 is still the most recommended setting here.
>>>> 
>>>> 
>>>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov 
>>>> <dl...@gmail.com>
>>>> wrote:
>>>>> you may try SSVD.
>>>>> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Sing
>>>>> u
>>>>> lar
>>>>> +Value+Decomposition
>>>>> 
>>>>> but 4k eigenvectors (or, rather, singular values) is kind of still 
>>>>> a lot though and may push the precision out of the error estimates.
>>>>> I don't we had precision study for that many. Also need quite a 
>>>>> bit of memory to compute that (not to mention flops). More 
>>>>> realistically you probably may try 1k singular values . You may 
>>>>> try more if you have access to more powerful hardware than we did 
>>>>> in the studies but distributed computation time will grow at about 
>>>>> k^1.5, i.e. faster than linear, even if you have enough nodes for the tasks.
>>>>> 
>>>>> -d
>>>>> 
>>>>> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak 
>>>>> <t-...@expedia.com>
>>>> wrote:
>>>>>> Hi,
>>>>>> I am working on a clustering problem which involves determining 
>>>>>> the largest "k" eigenvectors of a very large matrix. The 
>>>>>> matrices, I work on, are typically of the order of 10^6 by 10^6.
>>>>>> Trying to do this using the Lanczos solver available in Mahout, I 
>>>>>> found it is very slow and takes around 1.5 minutes to compute 
>>>>>> each
>>>> eigenvectors.
>>>>>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>>>>> 
>>>>>> So I am looking for something faster to solve the "Eigen decomposition"
>>>>>> problem for very large sparse matrix. Please suggest me what 
>>>>>> should I
>>>> use ?
>>>>>> 
>>>>>> 
>>>>>> Thanks,
>>>>>> Aniruddha
>>>>>> 
>>>> 
>>> 

Re: eigendecomposition of very large matrices

Posted by Dan Brickley <da...@danbri.org>.



On 26 Jul 2012, at 21:21, Aniruddha Basak <t-...@expedia.com> wrote:

> Actually that's my confusion. I don't need the eigenvectors of AA'
> but of A ! 
> If I can find a matrix B such that BB'=A, then from the SVD decomposition of B
> we can get the eigenvectors of A. But how to get B in that case ?

Does it help us if A is symmetric?

Dan

> 
> Aniruddha
> 
> 
> -----Original Message-----
> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com] 
> Sent: Thursday, July 26, 2012 1:18 PM
> To: user@mahout.apache.org
> Subject: Re: eigendecomposition of very large matrices
> 
> See http://en.wikipedia.org/wiki/Singular_value_decomposition,
> "relation to eigenvalue decomposition".
> 
> Depending on what you consider source for the eigendecompostion, AA'
> or A'A, the eigenvectors would be column vectors of U or V respectively.
> 
> On Thu, Jul 26, 2012 at 1:12 PM, Aniruddha Basak <t-...@expedia.com> wrote:
>> Hi,
>> I am trying to use SSVD instead of Lanczos, as a part of Spectral Kmeans.
>> However, I could not find the relation between the eigenvectors and U, V matrices.
>> Can someone please tell me, how to retrieve the eigenvectors from SSVD decomposition ?
>> 
>> Thanks,
>> Aniruddha
>> 
>> 
>> 
>> -----Original Message-----
>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>> Sent: Thursday, July 19, 2012 10:53 PM
>> To: user@mahout.apache.org
>> Subject: RE: eigendecomposition of very large matrices
>> 
>> Pps if you do insist on having a lot of k then you'll benefit from smaller hdfs block size, not larger.
>> On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:
>> 
>>> Yeah I see OK. Both two experiments conducted with mahout ssvd I am 
>>> familiar with dealt with input size greater than yours element wise, 
>>> on a quite modest node count. So i don't think your input size will 
>>> be a problem. But the number of singular values will be.
>>> 
>>> But I doubt any input will yield anything useful beyond k=200 but 
>>> statistical noise. Even if you have a good decay of the singular values.
>>> But I bet you don't need that many. You can fit significantly more 
>>> 'clusters' on a 'fairly small' dimensional space.
>>> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:
>>> 
>>>> Thanks Dmitriy for your reply.
>>>> The matrix I am working on, has 10-20 non zero entries per row. So 
>>>> its very sparse.
>>>> I am trying to do spectral clustering which involves eigen-decomposition.
>>>> I am wondering whether anyone has tried to do spectral clustering 
>>>> using mahout for very large affinity matrix (input).
>>>> 
>>>> Aniruddha
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>>> Sent: Thursday, July 19, 2012 6:28 PM
>>>> To: user@mahout.apache.org
>>>> Subject: Re: eigendecomposition of very large matrices
>>>> 
>>>> very significant sparsity may be a problem though for -q >=1 parameters.
>>>> Again, depends on the hardware you have and the # of non-zero 
>>>> elements in the input. but -q=1 is still the most recommended setting here.
>>>> 
>>>> 
>>>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov 
>>>> <dl...@gmail.com>
>>>> wrote:
>>>>> you may try SSVD.
>>>>> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Sing
>>>>> u
>>>>> lar
>>>>> +Value+Decomposition
>>>>> 
>>>>> but 4k eigenvectors (or, rather, singular values) is kind of still 
>>>>> a lot though and may push the precision out of the error estimates.
>>>>> I don't we had precision study for that many. Also need quite a 
>>>>> bit of memory to compute that (not to mention flops). More 
>>>>> realistically you probably may try 1k singular values . You may 
>>>>> try more if you have access to more powerful hardware than we did 
>>>>> in the studies but distributed computation time will grow at about 
>>>>> k^1.5, i.e. faster than linear, even if you have enough nodes for the tasks.
>>>>> 
>>>>> -d
>>>>> 
>>>>> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak 
>>>>> <t-...@expedia.com>
>>>> wrote:
>>>>>> Hi,
>>>>>> I am working on a clustering problem which involves determining 
>>>>>> the largest "k" eigenvectors of a very large matrix. The 
>>>>>> matrices, I work on, are typically of the order of 10^6 by 10^6.
>>>>>> Trying to do this using the Lanczos solver available in Mahout, I 
>>>>>> found it is very slow and takes around 1.5 minutes to compute 
>>>>>> each
>>>> eigenvectors.
>>>>>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>>>>> 
>>>>>> So I am looking for something faster to solve the "Eigen decomposition"
>>>>>> problem for very large sparse matrix. Please suggest me what 
>>>>>> should I
>>>> use ?
>>>>>> 
>>>>>> 
>>>>>> Thanks,
>>>>>> Aniruddha
>>>>>> 
>>>> 
>>> 

Re: eigendecomposition of very large matrices

Posted by Dmitriy Lyubimov <dl...@gmail.com>.
i take it back about Lanczos.

On Thu, Jul 26, 2012 at 1:30 PM, Dmitriy Lyubimov <dl...@gmail.com> wrote:
> Oops. I actually don't know that. SSVD is SVD (as much as Lanczos is).
>
> I guess you need help from the rest of the collective.
>
> On Thu, Jul 26, 2012 at 1:21 PM, Aniruddha Basak <t-...@expedia.com> wrote:
>> Actually that's my confusion. I don't need the eigenvectors of AA'
>> but of A !
>> If I can find a matrix B such that BB'=A, then from the SVD decomposition of B
>> we can get the eigenvectors of A. But how to get B in that case ?
>>
>>
>> Aniruddha
>>
>>
>> -----Original Message-----
>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>> Sent: Thursday, July 26, 2012 1:18 PM
>> To: user@mahout.apache.org
>> Subject: Re: eigendecomposition of very large matrices
>>
>> See http://en.wikipedia.org/wiki/Singular_value_decomposition,
>> "relation to eigenvalue decomposition".
>>
>> Depending on what you consider source for the eigendecompostion, AA'
>> or A'A, the eigenvectors would be column vectors of U or V respectively.
>>
>> On Thu, Jul 26, 2012 at 1:12 PM, Aniruddha Basak <t-...@expedia.com> wrote:
>>> Hi,
>>> I am trying to use SSVD instead of Lanczos, as a part of Spectral Kmeans.
>>> However, I could not find the relation between the eigenvectors and U, V matrices.
>>> Can someone please tell me, how to retrieve the eigenvectors from SSVD decomposition ?
>>>
>>> Thanks,
>>> Aniruddha
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>> Sent: Thursday, July 19, 2012 10:53 PM
>>> To: user@mahout.apache.org
>>> Subject: RE: eigendecomposition of very large matrices
>>>
>>> Pps if you do insist on having a lot of k then you'll benefit from smaller hdfs block size, not larger.
>>> On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:
>>>
>>>> Yeah I see OK. Both two experiments conducted with mahout ssvd I am
>>>> familiar with dealt with input size greater than yours element wise,
>>>> on a quite modest node count. So i don't think your input size will
>>>> be a problem. But the number of singular values will be.
>>>>
>>>> But I doubt any input will yield anything useful beyond k=200 but
>>>> statistical noise. Even if you have a good decay of the singular values.
>>>> But I bet you don't need that many. You can fit significantly more
>>>> 'clusters' on a 'fairly small' dimensional space.
>>>> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:
>>>>
>>>>> Thanks Dmitriy for your reply.
>>>>> The matrix I am working on, has 10-20 non zero entries per row. So
>>>>> its very sparse.
>>>>> I am trying to do spectral clustering which involves eigen-decomposition.
>>>>> I am wondering whether anyone has tried to do spectral clustering
>>>>> using mahout for very large affinity matrix (input).
>>>>>
>>>>> Aniruddha
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>>>> Sent: Thursday, July 19, 2012 6:28 PM
>>>>> To: user@mahout.apache.org
>>>>> Subject: Re: eigendecomposition of very large matrices
>>>>>
>>>>> very significant sparsity may be a problem though for -q >=1 parameters.
>>>>> Again, depends on the hardware you have and the # of non-zero
>>>>> elements in the input. but -q=1 is still the most recommended setting here.
>>>>>
>>>>>
>>>>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov
>>>>> <dl...@gmail.com>
>>>>> wrote:
>>>>> > you may try SSVD.
>>>>> > https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Sing
>>>>> > u
>>>>> > lar
>>>>> > +Value+Decomposition
>>>>> >
>>>>> > but 4k eigenvectors (or, rather, singular values) is kind of still
>>>>> > a lot though and may push the precision out of the error estimates.
>>>>> > I don't we had precision study for that many. Also need quite a
>>>>> > bit of memory to compute that (not to mention flops). More
>>>>> > realistically you probably may try 1k singular values . You may
>>>>> > try more if you have access to more powerful hardware than we did
>>>>> > in the studies but distributed computation time will grow at about
>>>>> > k^1.5, i.e. faster than linear, even if you have enough nodes for the tasks.
>>>>> >
>>>>> > -d
>>>>> >
>>>>> > On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak
>>>>> > <t-...@expedia.com>
>>>>> wrote:
>>>>> >> Hi,
>>>>> >> I am working on a clustering problem which involves determining
>>>>> >> the largest "k" eigenvectors of a very large matrix. The
>>>>> >> matrices, I work on, are typically of the order of 10^6 by 10^6.
>>>>> >> Trying to do this using the Lanczos solver available in Mahout, I
>>>>> >> found it is very slow and takes around 1.5 minutes to compute
>>>>> >> each
>>>>> eigenvectors.
>>>>> >> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>>>> >>
>>>>> >> So I am looking for something faster to solve the "Eigen decomposition"
>>>>> >> problem for very large sparse matrix. Please suggest me what
>>>>> >> should I
>>>>> use ?
>>>>> >>
>>>>> >>
>>>>> >> Thanks,
>>>>> >> Aniruddha
>>>>> >>
>>>>>
>>>>

Re: eigendecomposition of very large matrices

Posted by Dmitriy Lyubimov <dl...@gmail.com>.
Oops. I actually don't know that. SSVD is SVD (as much as Lanczos is).

I guess you need help from the rest of the collective.

On Thu, Jul 26, 2012 at 1:21 PM, Aniruddha Basak <t-...@expedia.com> wrote:
> Actually that's my confusion. I don't need the eigenvectors of AA'
> but of A !
> If I can find a matrix B such that BB'=A, then from the SVD decomposition of B
> we can get the eigenvectors of A. But how to get B in that case ?
>
>
> Aniruddha
>
>
> -----Original Message-----
> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> Sent: Thursday, July 26, 2012 1:18 PM
> To: user@mahout.apache.org
> Subject: Re: eigendecomposition of very large matrices
>
> See http://en.wikipedia.org/wiki/Singular_value_decomposition,
> "relation to eigenvalue decomposition".
>
> Depending on what you consider source for the eigendecompostion, AA'
> or A'A, the eigenvectors would be column vectors of U or V respectively.
>
> On Thu, Jul 26, 2012 at 1:12 PM, Aniruddha Basak <t-...@expedia.com> wrote:
>> Hi,
>> I am trying to use SSVD instead of Lanczos, as a part of Spectral Kmeans.
>> However, I could not find the relation between the eigenvectors and U, V matrices.
>> Can someone please tell me, how to retrieve the eigenvectors from SSVD decomposition ?
>>
>> Thanks,
>> Aniruddha
>>
>>
>>
>> -----Original Message-----
>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>> Sent: Thursday, July 19, 2012 10:53 PM
>> To: user@mahout.apache.org
>> Subject: RE: eigendecomposition of very large matrices
>>
>> Pps if you do insist on having a lot of k then you'll benefit from smaller hdfs block size, not larger.
>> On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:
>>
>>> Yeah I see OK. Both two experiments conducted with mahout ssvd I am
>>> familiar with dealt with input size greater than yours element wise,
>>> on a quite modest node count. So i don't think your input size will
>>> be a problem. But the number of singular values will be.
>>>
>>> But I doubt any input will yield anything useful beyond k=200 but
>>> statistical noise. Even if you have a good decay of the singular values.
>>> But I bet you don't need that many. You can fit significantly more
>>> 'clusters' on a 'fairly small' dimensional space.
>>> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:
>>>
>>>> Thanks Dmitriy for your reply.
>>>> The matrix I am working on, has 10-20 non zero entries per row. So
>>>> its very sparse.
>>>> I am trying to do spectral clustering which involves eigen-decomposition.
>>>> I am wondering whether anyone has tried to do spectral clustering
>>>> using mahout for very large affinity matrix (input).
>>>>
>>>> Aniruddha
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>>> Sent: Thursday, July 19, 2012 6:28 PM
>>>> To: user@mahout.apache.org
>>>> Subject: Re: eigendecomposition of very large matrices
>>>>
>>>> very significant sparsity may be a problem though for -q >=1 parameters.
>>>> Again, depends on the hardware you have and the # of non-zero
>>>> elements in the input. but -q=1 is still the most recommended setting here.
>>>>
>>>>
>>>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov
>>>> <dl...@gmail.com>
>>>> wrote:
>>>> > you may try SSVD.
>>>> > https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Sing
>>>> > u
>>>> > lar
>>>> > +Value+Decomposition
>>>> >
>>>> > but 4k eigenvectors (or, rather, singular values) is kind of still
>>>> > a lot though and may push the precision out of the error estimates.
>>>> > I don't we had precision study for that many. Also need quite a
>>>> > bit of memory to compute that (not to mention flops). More
>>>> > realistically you probably may try 1k singular values . You may
>>>> > try more if you have access to more powerful hardware than we did
>>>> > in the studies but distributed computation time will grow at about
>>>> > k^1.5, i.e. faster than linear, even if you have enough nodes for the tasks.
>>>> >
>>>> > -d
>>>> >
>>>> > On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak
>>>> > <t-...@expedia.com>
>>>> wrote:
>>>> >> Hi,
>>>> >> I am working on a clustering problem which involves determining
>>>> >> the largest "k" eigenvectors of a very large matrix. The
>>>> >> matrices, I work on, are typically of the order of 10^6 by 10^6.
>>>> >> Trying to do this using the Lanczos solver available in Mahout, I
>>>> >> found it is very slow and takes around 1.5 minutes to compute
>>>> >> each
>>>> eigenvectors.
>>>> >> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>>> >>
>>>> >> So I am looking for something faster to solve the "Eigen decomposition"
>>>> >> problem for very large sparse matrix. Please suggest me what
>>>> >> should I
>>>> use ?
>>>> >>
>>>> >>
>>>> >> Thanks,
>>>> >> Aniruddha
>>>> >>
>>>>
>>>

RE: eigendecomposition of very large matrices

Posted by Aniruddha Basak <t-...@expedia.com>.
Actually that's my confusion. I don't need the eigenvectors of AA'
but of A ! 
If I can find a matrix B such that BB'=A, then from the SVD decomposition of B
we can get the eigenvectors of A. But how to get B in that case ?


Aniruddha


-----Original Message-----
From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com] 
Sent: Thursday, July 26, 2012 1:18 PM
To: user@mahout.apache.org
Subject: Re: eigendecomposition of very large matrices

See http://en.wikipedia.org/wiki/Singular_value_decomposition,
"relation to eigenvalue decomposition".

Depending on what you consider source for the eigendecompostion, AA'
or A'A, the eigenvectors would be column vectors of U or V respectively.

On Thu, Jul 26, 2012 at 1:12 PM, Aniruddha Basak <t-...@expedia.com> wrote:
> Hi,
> I am trying to use SSVD instead of Lanczos, as a part of Spectral Kmeans.
> However, I could not find the relation between the eigenvectors and U, V matrices.
> Can someone please tell me, how to retrieve the eigenvectors from SSVD decomposition ?
>
> Thanks,
> Aniruddha
>
>
>
> -----Original Message-----
> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> Sent: Thursday, July 19, 2012 10:53 PM
> To: user@mahout.apache.org
> Subject: RE: eigendecomposition of very large matrices
>
> Pps if you do insist on having a lot of k then you'll benefit from smaller hdfs block size, not larger.
> On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:
>
>> Yeah I see OK. Both two experiments conducted with mahout ssvd I am 
>> familiar with dealt with input size greater than yours element wise, 
>> on a quite modest node count. So i don't think your input size will 
>> be a problem. But the number of singular values will be.
>>
>> But I doubt any input will yield anything useful beyond k=200 but 
>> statistical noise. Even if you have a good decay of the singular values.
>> But I bet you don't need that many. You can fit significantly more 
>> 'clusters' on a 'fairly small' dimensional space.
>> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:
>>
>>> Thanks Dmitriy for your reply.
>>> The matrix I am working on, has 10-20 non zero entries per row. So 
>>> its very sparse.
>>> I am trying to do spectral clustering which involves eigen-decomposition.
>>> I am wondering whether anyone has tried to do spectral clustering 
>>> using mahout for very large affinity matrix (input).
>>>
>>> Aniruddha
>>>
>>>
>>> -----Original Message-----
>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>> Sent: Thursday, July 19, 2012 6:28 PM
>>> To: user@mahout.apache.org
>>> Subject: Re: eigendecomposition of very large matrices
>>>
>>> very significant sparsity may be a problem though for -q >=1 parameters.
>>> Again, depends on the hardware you have and the # of non-zero 
>>> elements in the input. but -q=1 is still the most recommended setting here.
>>>
>>>
>>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov 
>>> <dl...@gmail.com>
>>> wrote:
>>> > you may try SSVD.
>>> > https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Sing
>>> > u
>>> > lar
>>> > +Value+Decomposition
>>> >
>>> > but 4k eigenvectors (or, rather, singular values) is kind of still 
>>> > a lot though and may push the precision out of the error estimates.
>>> > I don't we had precision study for that many. Also need quite a 
>>> > bit of memory to compute that (not to mention flops). More 
>>> > realistically you probably may try 1k singular values . You may 
>>> > try more if you have access to more powerful hardware than we did 
>>> > in the studies but distributed computation time will grow at about 
>>> > k^1.5, i.e. faster than linear, even if you have enough nodes for the tasks.
>>> >
>>> > -d
>>> >
>>> > On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak 
>>> > <t-...@expedia.com>
>>> wrote:
>>> >> Hi,
>>> >> I am working on a clustering problem which involves determining 
>>> >> the largest "k" eigenvectors of a very large matrix. The 
>>> >> matrices, I work on, are typically of the order of 10^6 by 10^6.
>>> >> Trying to do this using the Lanczos solver available in Mahout, I 
>>> >> found it is very slow and takes around 1.5 minutes to compute 
>>> >> each
>>> eigenvectors.
>>> >> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>> >>
>>> >> So I am looking for something faster to solve the "Eigen decomposition"
>>> >> problem for very large sparse matrix. Please suggest me what 
>>> >> should I
>>> use ?
>>> >>
>>> >>
>>> >> Thanks,
>>> >> Aniruddha
>>> >>
>>>
>>

Re: eigendecomposition of very large matrices

Posted by Dmitriy Lyubimov <dl...@gmail.com>.
See http://en.wikipedia.org/wiki/Singular_value_decomposition,
"relation to eigenvalue decomposition".

Depending on what you consider source for the eigendecompostion, AA'
or A'A, the eigenvectors would be column vectors of U or V
respectively.

On Thu, Jul 26, 2012 at 1:12 PM, Aniruddha Basak <t-...@expedia.com> wrote:
> Hi,
> I am trying to use SSVD instead of Lanczos, as a part of Spectral Kmeans.
> However, I could not find the relation between the eigenvectors and U, V matrices.
> Can someone please tell me, how to retrieve the eigenvectors from SSVD decomposition ?
>
> Thanks,
> Aniruddha
>
>
>
> -----Original Message-----
> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> Sent: Thursday, July 19, 2012 10:53 PM
> To: user@mahout.apache.org
> Subject: RE: eigendecomposition of very large matrices
>
> Pps if you do insist on having a lot of k then you'll benefit from smaller hdfs block size, not larger.
> On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:
>
>> Yeah I see OK. Both two experiments conducted with mahout ssvd I am
>> familiar with dealt with input size greater than yours element wise,
>> on a quite modest node count. So i don't think your input size will be
>> a problem. But the number of singular values will be.
>>
>> But I doubt any input will yield anything useful beyond k=200 but
>> statistical noise. Even if you have a good decay of the singular values.
>> But I bet you don't need that many. You can fit significantly more
>> 'clusters' on a 'fairly small' dimensional space.
>> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:
>>
>>> Thanks Dmitriy for your reply.
>>> The matrix I am working on, has 10-20 non zero entries per row. So
>>> its very sparse.
>>> I am trying to do spectral clustering which involves eigen-decomposition.
>>> I am wondering whether anyone has tried to do spectral clustering
>>> using mahout for very large affinity matrix (input).
>>>
>>> Aniruddha
>>>
>>>
>>> -----Original Message-----
>>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>>> Sent: Thursday, July 19, 2012 6:28 PM
>>> To: user@mahout.apache.org
>>> Subject: Re: eigendecomposition of very large matrices
>>>
>>> very significant sparsity may be a problem though for -q >=1 parameters.
>>> Again, depends on the hardware you have and the # of non-zero
>>> elements in the input. but -q=1 is still the most recommended setting here.
>>>
>>>
>>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov <dl...@gmail.com>
>>> wrote:
>>> > you may try SSVD.
>>> > https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singu
>>> > lar
>>> > +Value+Decomposition
>>> >
>>> > but 4k eigenvectors (or, rather, singular values) is kind of still
>>> > a lot though and may push the precision out of the error estimates.
>>> > I don't we had precision study for that many. Also need quite a bit
>>> > of memory to compute that (not to mention flops). More
>>> > realistically you probably may try 1k singular values . You may try
>>> > more if you have access to more powerful hardware than we did in
>>> > the studies but distributed computation time will grow at about
>>> > k^1.5, i.e. faster than linear, even if you have enough nodes for the tasks.
>>> >
>>> > -d
>>> >
>>> > On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak
>>> > <t-...@expedia.com>
>>> wrote:
>>> >> Hi,
>>> >> I am working on a clustering problem which involves determining
>>> >> the largest "k" eigenvectors of a very large matrix. The matrices,
>>> >> I work on, are typically of the order of 10^6 by 10^6.
>>> >> Trying to do this using the Lanczos solver available in Mahout, I
>>> >> found it is very slow and takes around 1.5 minutes to compute each
>>> eigenvectors.
>>> >> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>> >>
>>> >> So I am looking for something faster to solve the "Eigen decomposition"
>>> >> problem for very large sparse matrix. Please suggest me what
>>> >> should I
>>> use ?
>>> >>
>>> >>
>>> >> Thanks,
>>> >> Aniruddha
>>> >>
>>>
>>

RE: eigendecomposition of very large matrices

Posted by Aniruddha Basak <t-...@expedia.com>.
Hi,
I am trying to use SSVD instead of Lanczos, as a part of Spectral Kmeans. 
However, I could not find the relation between the eigenvectors and U, V matrices.
Can someone please tell me, how to retrieve the eigenvectors from SSVD decomposition ?

Thanks,
Aniruddha



-----Original Message-----
From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com] 
Sent: Thursday, July 19, 2012 10:53 PM
To: user@mahout.apache.org
Subject: RE: eigendecomposition of very large matrices

Pps if you do insist on having a lot of k then you'll benefit from smaller hdfs block size, not larger.
On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:

> Yeah I see OK. Both two experiments conducted with mahout ssvd I am 
> familiar with dealt with input size greater than yours element wise, 
> on a quite modest node count. So i don't think your input size will be 
> a problem. But the number of singular values will be.
>
> But I doubt any input will yield anything useful beyond k=200 but 
> statistical noise. Even if you have a good decay of the singular values.
> But I bet you don't need that many. You can fit significantly more 
> 'clusters' on a 'fairly small' dimensional space.
> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:
>
>> Thanks Dmitriy for your reply.
>> The matrix I am working on, has 10-20 non zero entries per row. So 
>> its very sparse.
>> I am trying to do spectral clustering which involves eigen-decomposition.
>> I am wondering whether anyone has tried to do spectral clustering 
>> using mahout for very large affinity matrix (input).
>>
>> Aniruddha
>>
>>
>> -----Original Message-----
>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>> Sent: Thursday, July 19, 2012 6:28 PM
>> To: user@mahout.apache.org
>> Subject: Re: eigendecomposition of very large matrices
>>
>> very significant sparsity may be a problem though for -q >=1 parameters.
>> Again, depends on the hardware you have and the # of non-zero 
>> elements in the input. but -q=1 is still the most recommended setting here.
>>
>>
>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov <dl...@gmail.com>
>> wrote:
>> > you may try SSVD.
>> > https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singu
>> > lar
>> > +Value+Decomposition
>> >
>> > but 4k eigenvectors (or, rather, singular values) is kind of still 
>> > a lot though and may push the precision out of the error estimates. 
>> > I don't we had precision study for that many. Also need quite a bit 
>> > of memory to compute that (not to mention flops). More 
>> > realistically you probably may try 1k singular values . You may try 
>> > more if you have access to more powerful hardware than we did in 
>> > the studies but distributed computation time will grow at about 
>> > k^1.5, i.e. faster than linear, even if you have enough nodes for the tasks.
>> >
>> > -d
>> >
>> > On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak 
>> > <t-...@expedia.com>
>> wrote:
>> >> Hi,
>> >> I am working on a clustering problem which involves determining 
>> >> the largest "k" eigenvectors of a very large matrix. The matrices, 
>> >> I work on, are typically of the order of 10^6 by 10^6.
>> >> Trying to do this using the Lanczos solver available in Mahout, I 
>> >> found it is very slow and takes around 1.5 minutes to compute each
>> eigenvectors.
>> >> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>> >>
>> >> So I am looking for something faster to solve the "Eigen decomposition"
>> >> problem for very large sparse matrix. Please suggest me what 
>> >> should I
>> use ?
>> >>
>> >>
>> >> Thanks,
>> >> Aniruddha
>> >>
>>
>

RE: eigendecomposition of very large matrices

Posted by Dmitriy Lyubimov <dl...@gmail.com>.
Pps if you do insist on having a lot of k then you'll benefit from smaller
hdfs block size, not larger.
On Jul 19, 2012 10:50 PM, "Dmitriy Lyubimov" <dl...@gmail.com> wrote:

> Yeah I see OK. Both two experiments conducted with mahout ssvd I am
> familiar with dealt with input size greater than yours element wise, on a
> quite modest node count. So i don't think your input size will be a
> problem. But the number of singular values will be.
>
> But I doubt any input will yield anything useful beyond k=200 but
> statistical noise. Even if you have a good decay of the singular values.
> But I bet you don't need that many. You can fit significantly more
> 'clusters' on a 'fairly small' dimensional space.
> On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:
>
>> Thanks Dmitriy for your reply.
>> The matrix I am working on, has 10-20 non zero entries per row. So its
>> very sparse.
>> I am trying to do spectral clustering which involves eigen-decomposition.
>> I am wondering whether anyone has tried to do spectral clustering using
>> mahout
>> for very large affinity matrix (input).
>>
>> Aniruddha
>>
>>
>> -----Original Message-----
>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>> Sent: Thursday, July 19, 2012 6:28 PM
>> To: user@mahout.apache.org
>> Subject: Re: eigendecomposition of very large matrices
>>
>> very significant sparsity may be a problem though for -q >=1 parameters.
>> Again, depends on the hardware you have and the # of non-zero elements in
>> the input. but -q=1 is still the most recommended setting here.
>>
>>
>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov <dl...@gmail.com>
>> wrote:
>> > you may try SSVD.
>> > https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singular
>> > +Value+Decomposition
>> >
>> > but 4k eigenvectors (or, rather, singular values) is kind of still a
>> > lot though and may push the precision out of the error estimates. I
>> > don't we had precision study for that many. Also need quite a bit of
>> > memory to compute that (not to mention flops). More realistically you
>> > probably may try 1k singular values . You may try more if you have
>> > access to more powerful hardware than we did in the studies but
>> > distributed computation time will grow at about k^1.5, i.e. faster
>> > than linear, even if you have enough nodes for the tasks.
>> >
>> > -d
>> >
>> > On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak <t-...@expedia.com>
>> wrote:
>> >> Hi,
>> >> I am working on a clustering problem which involves determining the
>> >> largest "k" eigenvectors of a very large matrix. The matrices, I work
>> >> on, are typically of the order of 10^6 by 10^6.
>> >> Trying to do this using the Lanczos solver available in Mahout, I
>> >> found it is very slow and takes around 1.5 minutes to compute each
>> eigenvectors.
>> >> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>> >>
>> >> So I am looking for something faster to solve the "Eigen decomposition"
>> >> problem for very large sparse matrix. Please suggest me what should I
>> use ?
>> >>
>> >>
>> >> Thanks,
>> >> Aniruddha
>> >>
>>
>

RE: eigendecomposition of very large matrices

Posted by Dmitriy Lyubimov <dl...@gmail.com>.
Yeah I see OK. Both two experiments conducted with mahout ssvd I am
familiar with dealt with input size greater than yours element wise, on a
quite modest node count. So i don't think your input size will be a
problem. But the number of singular values will be.

But I doubt any input will yield anything useful beyond k=200 but
statistical noise. Even if you have a good decay of the singular values.
But I bet you don't need that many. You can fit significantly more
'clusters' on a 'fairly small' dimensional space.
On Jul 19, 2012 6:33 PM, "Aniruddha Basak" <t-...@expedia.com> wrote:

> Thanks Dmitriy for your reply.
> The matrix I am working on, has 10-20 non zero entries per row. So its
> very sparse.
> I am trying to do spectral clustering which involves eigen-decomposition.
> I am wondering whether anyone has tried to do spectral clustering using
> mahout
> for very large affinity matrix (input).
>
> Aniruddha
>
>
> -----Original Message-----
> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> Sent: Thursday, July 19, 2012 6:28 PM
> To: user@mahout.apache.org
> Subject: Re: eigendecomposition of very large matrices
>
> very significant sparsity may be a problem though for -q >=1 parameters.
> Again, depends on the hardware you have and the # of non-zero elements in
> the input. but -q=1 is still the most recommended setting here.
>
>
> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov <dl...@gmail.com>
> wrote:
> > you may try SSVD.
> > https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singular
> > +Value+Decomposition
> >
> > but 4k eigenvectors (or, rather, singular values) is kind of still a
> > lot though and may push the precision out of the error estimates. I
> > don't we had precision study for that many. Also need quite a bit of
> > memory to compute that (not to mention flops). More realistically you
> > probably may try 1k singular values . You may try more if you have
> > access to more powerful hardware than we did in the studies but
> > distributed computation time will grow at about k^1.5, i.e. faster
> > than linear, even if you have enough nodes for the tasks.
> >
> > -d
> >
> > On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak <t-...@expedia.com>
> wrote:
> >> Hi,
> >> I am working on a clustering problem which involves determining the
> >> largest "k" eigenvectors of a very large matrix. The matrices, I work
> >> on, are typically of the order of 10^6 by 10^6.
> >> Trying to do this using the Lanczos solver available in Mahout, I
> >> found it is very slow and takes around 1.5 minutes to compute each
> eigenvectors.
> >> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
> >>
> >> So I am looking for something faster to solve the "Eigen decomposition"
> >> problem for very large sparse matrix. Please suggest me what should I
> use ?
> >>
> >>
> >> Thanks,
> >> Aniruddha
> >>
>

Re: eigendecomposition of very large matrices

Posted by Ted Dunning <te...@gmail.com>.
I don't see the direct linear connection between dimensionality and number
of clusters.  To wit, there are 2^d corners of a hyper-cube of dimension d.
 Putting it differently, the quasi-orthogonal packing capacity of
d-dimensional space is considerably larger than d for d > 30 or so.  In
fact, the capacity grows exponentially with d.

Likewise, you can approximate point-wise distances very well with dimension
proportional to log d.  This implies that an orthogonal basis of C log d
for small C should suffice to describe your data.  The log of 10^6 is only
14.

These two arguments (quasi-orthogonality and Johnson-Lindenstrauss) come to
the same conclusion from opposite directions.  I have a hard time believing
that you need more than 200 dimensions here.  This is especially true since
you have such sparse vectors.

On Thu, Jul 19, 2012 at 7:25 PM, Aniruddha Basak <t-...@expedia.com>wrote:

> Hi Ted,
> Thanks for your reply.
> I am doing clustering of 10^6 objects (thus affinity matrix of that size)
> and expect 4000-10,000 clusters. That's why I need those many eigenvectors.
>
> Will SVD be faster in this case ?
>
> Aniruddha
>
>
>
> On Jul 19, 2012, at 7:20 PM, "Ted Dunning" <te...@gmail.com> wrote:
>
> > Folks have done SVD on very large matrices with Mahout, but not
> necessarily
> > for spectral clustering.
> >
> > Are you sure that you actually need 4000 vectors?  As sparse as your data
> > is, I would expect that no more than a few hundred are anything but
> > statistical noise.
> >
> > On Thu, Jul 19, 2012 at 6:32 PM, Aniruddha Basak <t-abasak@expedia.com
> >wrote:
> >
> >> Thanks Dmitriy for your reply.
> >> The matrix I am working on, has 10-20 non zero entries per row. So its
> >> very sparse.
> >> I am trying to do spectral clustering which involves
> eigen-decomposition.
> >> I am wondering whether anyone has tried to do spectral clustering using
> >> mahout
> >> for very large affinity matrix (input).
> >>
> >> Aniruddha
> >>
> >>
> >> -----Original Message-----
> >> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> >> Sent: Thursday, July 19, 2012 6:28 PM
> >> To: user@mahout.apache.org
> >> Subject: Re: eigendecomposition of very large matrices
> >>
> >> very significant sparsity may be a problem though for -q >=1 parameters.
> >> Again, depends on the hardware you have and the # of non-zero elements
> in
> >> the input. but -q=1 is still the most recommended setting here.
> >>
> >>
> >> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov <dl...@gmail.com>
> >> wrote:
> >>> you may try SSVD.
> >>> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singular
> >>> +Value+Decomposition
> >>>
> >>> but 4k eigenvectors (or, rather, singular values) is kind of still a
> >>> lot though and may push the precision out of the error estimates. I
> >>> don't we had precision study for that many. Also need quite a bit of
> >>> memory to compute that (not to mention flops). More realistically you
> >>> probably may try 1k singular values . You may try more if you have
> >>> access to more powerful hardware than we did in the studies but
> >>> distributed computation time will grow at about k^1.5, i.e. faster
> >>> than linear, even if you have enough nodes for the tasks.
> >>>
> >>> -d
> >>>
> >>> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak <t-abasak@expedia.com
> >
> >> wrote:
> >>>> Hi,
> >>>> I am working on a clustering problem which involves determining the
> >>>> largest "k" eigenvectors of a very large matrix. The matrices, I work
> >>>> on, are typically of the order of 10^6 by 10^6.
> >>>> Trying to do this using the Lanczos solver available in Mahout, I
> >>>> found it is very slow and takes around 1.5 minutes to compute each
> >> eigenvectors.
> >>>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
> >>>>
> >>>> So I am looking for something faster to solve the "Eigen
> decomposition"
> >>>> problem for very large sparse matrix. Please suggest me what should I
> >> use ?
> >>>>
> >>>>
> >>>> Thanks,
> >>>> Aniruddha
> >>>>
> >>
>

Re: eigendecomposition of very large matrices

Posted by Aniruddha Basak <t-...@expedia.com>.
Hi Ted,
Thanks for your reply.
I am doing clustering of 10^6 objects (thus affinity matrix of that size) and expect 4000-10,000 clusters. That's why I need those many eigenvectors.

Will SVD be faster in this case ?

Aniruddha 



On Jul 19, 2012, at 7:20 PM, "Ted Dunning" <te...@gmail.com> wrote:

> Folks have done SVD on very large matrices with Mahout, but not necessarily
> for spectral clustering.
> 
> Are you sure that you actually need 4000 vectors?  As sparse as your data
> is, I would expect that no more than a few hundred are anything but
> statistical noise.
> 
> On Thu, Jul 19, 2012 at 6:32 PM, Aniruddha Basak <t-...@expedia.com>wrote:
> 
>> Thanks Dmitriy for your reply.
>> The matrix I am working on, has 10-20 non zero entries per row. So its
>> very sparse.
>> I am trying to do spectral clustering which involves eigen-decomposition.
>> I am wondering whether anyone has tried to do spectral clustering using
>> mahout
>> for very large affinity matrix (input).
>> 
>> Aniruddha
>> 
>> 
>> -----Original Message-----
>> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
>> Sent: Thursday, July 19, 2012 6:28 PM
>> To: user@mahout.apache.org
>> Subject: Re: eigendecomposition of very large matrices
>> 
>> very significant sparsity may be a problem though for -q >=1 parameters.
>> Again, depends on the hardware you have and the # of non-zero elements in
>> the input. but -q=1 is still the most recommended setting here.
>> 
>> 
>> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov <dl...@gmail.com>
>> wrote:
>>> you may try SSVD.
>>> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singular
>>> +Value+Decomposition
>>> 
>>> but 4k eigenvectors (or, rather, singular values) is kind of still a
>>> lot though and may push the precision out of the error estimates. I
>>> don't we had precision study for that many. Also need quite a bit of
>>> memory to compute that (not to mention flops). More realistically you
>>> probably may try 1k singular values . You may try more if you have
>>> access to more powerful hardware than we did in the studies but
>>> distributed computation time will grow at about k^1.5, i.e. faster
>>> than linear, even if you have enough nodes for the tasks.
>>> 
>>> -d
>>> 
>>> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak <t-...@expedia.com>
>> wrote:
>>>> Hi,
>>>> I am working on a clustering problem which involves determining the
>>>> largest "k" eigenvectors of a very large matrix. The matrices, I work
>>>> on, are typically of the order of 10^6 by 10^6.
>>>> Trying to do this using the Lanczos solver available in Mahout, I
>>>> found it is very slow and takes around 1.5 minutes to compute each
>> eigenvectors.
>>>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>>> 
>>>> So I am looking for something faster to solve the "Eigen decomposition"
>>>> problem for very large sparse matrix. Please suggest me what should I
>> use ?
>>>> 
>>>> 
>>>> Thanks,
>>>> Aniruddha
>>>> 
>> 

Re: eigendecomposition of very large matrices

Posted by Ted Dunning <te...@gmail.com>.
Folks have done SVD on very large matrices with Mahout, but not necessarily
for spectral clustering.

Are you sure that you actually need 4000 vectors?  As sparse as your data
is, I would expect that no more than a few hundred are anything but
statistical noise.

On Thu, Jul 19, 2012 at 6:32 PM, Aniruddha Basak <t-...@expedia.com>wrote:

> Thanks Dmitriy for your reply.
> The matrix I am working on, has 10-20 non zero entries per row. So its
> very sparse.
> I am trying to do spectral clustering which involves eigen-decomposition.
> I am wondering whether anyone has tried to do spectral clustering using
> mahout
> for very large affinity matrix (input).
>
> Aniruddha
>
>
> -----Original Message-----
> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> Sent: Thursday, July 19, 2012 6:28 PM
> To: user@mahout.apache.org
> Subject: Re: eigendecomposition of very large matrices
>
> very significant sparsity may be a problem though for -q >=1 parameters.
> Again, depends on the hardware you have and the # of non-zero elements in
> the input. but -q=1 is still the most recommended setting here.
>
>
> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov <dl...@gmail.com>
> wrote:
> > you may try SSVD.
> > https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singular
> > +Value+Decomposition
> >
> > but 4k eigenvectors (or, rather, singular values) is kind of still a
> > lot though and may push the precision out of the error estimates. I
> > don't we had precision study for that many. Also need quite a bit of
> > memory to compute that (not to mention flops). More realistically you
> > probably may try 1k singular values . You may try more if you have
> > access to more powerful hardware than we did in the studies but
> > distributed computation time will grow at about k^1.5, i.e. faster
> > than linear, even if you have enough nodes for the tasks.
> >
> > -d
> >
> > On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak <t-...@expedia.com>
> wrote:
> >> Hi,
> >> I am working on a clustering problem which involves determining the
> >> largest "k" eigenvectors of a very large matrix. The matrices, I work
> >> on, are typically of the order of 10^6 by 10^6.
> >> Trying to do this using the Lanczos solver available in Mahout, I
> >> found it is very slow and takes around 1.5 minutes to compute each
> eigenvectors.
> >> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
> >>
> >> So I am looking for something faster to solve the "Eigen decomposition"
> >> problem for very large sparse matrix. Please suggest me what should I
> use ?
> >>
> >>
> >> Thanks,
> >> Aniruddha
> >>
>

RE: eigendecomposition of very large matrices

Posted by Aniruddha Basak <t-...@expedia.com>.
Hi ,
Sorry for my late response. 
Thanks Dmitry and Ted for your suggestions about smaller value of k and statistical noise.
I have some knowledge about the problem I am dealing with and that’s why I expected that.
It is like this: there are some inherent groups (clusters) in my dataset and items in one group
are essentially not at all similar to items from other groups. That’s the reason of the sparsity.
For instance, if items 10,11,12,....,30 are in one group, for these rows in the affinity matrix only
non-zero columns will be 10,....30 and rest all zero. 
But I expected the clustering algorithms to detect these groups and in addition find some sub-groups
which is my main requirement. That is maybe 10,11,...20 and 21,22,...30 are two clusters from that group.
The clustering process could be executed for separate groups sequentially but I wished to exploit the
parallelism of HADOOP and perform the clustering process faster.
With that said, can u suggest me something for this problem. 

Dan, I have tested the spectral-kmeans code comparing with my matlab script and it is running ok now !
Although, I did not test the last kmeans clustering step as it is initialization dependent and I assumed that part 
to be fine. 
After my investigations I found two issues with the code:
1. I still could not find any reason why L = D^0.5 * W * D^0.5 ? I think it should be changed to D^-0.5 (which I did in the code
I am using). 
2. Lanczos Solver: Other than the fact this is time consuming for large matrices, I think there is another important issue.
For spectral clustering we need the largest "k" eigenvectors of the Laplacian. But the Lanczos solver gives the eigenvectors
in ascending order of eigenvalues. Jake Mannix (http://lucene.472066.n3.nabble.com/Lanczos-Algorithm-td1929299.html)
suggested to go for 4k-5k eigenvectors  when we need "k" ones. However, if we really need the largest "k" we have to get
all eigenvectors of the Laplacian. 
I will try the SSVD and let you know.

Thanks,
Aniruddha

 

-----Original Message-----
From: Dan Brickley [mailto:danbri@danbri.org] 
Sent: Thursday, July 19, 2012 11:12 PM
To: Aniruddha Basak
Subject: Re: eigendecomposition of very large matrices

Hi there,

I started replying below, and then eventually (hey, it's early morning for me :) ... then realised that you were the original poster here. I was going to say that we had been trying to get spectral clustering working again.

What was the conclusion of your investigations? Did you get the original spectralkmeans code running ok, even if it does not suit your problem?

Porting / adapting to use SSVD (and maybe Ted's new kmeans stuff) sounds useful...

Dan


On 20 July 2012 02:32, Aniruddha Basak <t-...@expedia.com> wrote:
> Thanks Dmitriy for your reply.
> The matrix I am working on, has 10-20 non zero entries per row. So its very sparse.
> I am trying to do spectral clustering which involves eigen-decomposition.
> I am wondering whether anyone has tried to do spectral clustering 
> using mahout for very large affinity matrix (input).

Mahout does ship with a spectral clustering component, built on Mahout's SVD/Lancszos facility. It has suffered various forms of code-rot. Shannon, Aniruddha, and I have been trying to get it running reliably again. See 'bin/mahout spectralkmeans', https://cwiki.apache.org/MAHOUT/spectral-clustering.html and nearby

> Aniruddha
>
>
> -----Original Message-----
> From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com]
> Sent: Thursday, July 19, 2012 6:28 PM
> To: user@mahout.apache.org
> Subject: Re: eigendecomposition of very large matrices
>
> very significant sparsity may be a problem though for -q >=1 parameters. Again, depends on the hardware you have and the # of non-zero elements in the input. but -q=1 is still the most recommended setting here.
>
>
> On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov <dl...@gmail.com> wrote:
>> you may try SSVD.
>> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singula
>> r
>> +Value+Decomposition
>>
>> but 4k eigenvectors (or, rather, singular values) is kind of still a 
>> lot though and may push the precision out of the error estimates. I 
>> don't we had precision study for that many. Also need quite a bit of 
>> memory to compute that (not to mention flops). More realistically you 
>> probably may try 1k singular values . You may try more if you have 
>> access to more powerful hardware than we did in the studies but 
>> distributed computation time will grow at about k^1.5, i.e. faster 
>> than linear, even if you have enough nodes for the tasks.
>>
>> -d
>>
>> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak <t-...@expedia.com> wrote:
>>> Hi,
>>> I am working on a clustering problem which involves determining the 
>>> largest "k" eigenvectors of a very large matrix. The matrices, I 
>>> work on, are typically of the order of 10^6 by 10^6.
>>> Trying to do this using the Lanczos solver available in Mahout, I 
>>> found it is very slow and takes around 1.5 minutes to compute each eigenvectors.
>>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>>
>>> So I am looking for something faster to solve the "Eigen decomposition"
>>> problem for very large sparse matrix. Please suggest me what should I use ?
>>>
>>>
>>> Thanks,
>>> Aniruddha
>>>

RE: eigendecomposition of very large matrices

Posted by Aniruddha Basak <t-...@expedia.com>.
Thanks Dmitriy for your reply.
The matrix I am working on, has 10-20 non zero entries per row. So its very sparse. 
I am trying to do spectral clustering which involves eigen-decomposition.
I am wondering whether anyone has tried to do spectral clustering using mahout
for very large affinity matrix (input).

Aniruddha


-----Original Message-----
From: Dmitriy Lyubimov [mailto:dlieu.7@gmail.com] 
Sent: Thursday, July 19, 2012 6:28 PM
To: user@mahout.apache.org
Subject: Re: eigendecomposition of very large matrices

very significant sparsity may be a problem though for -q >=1 parameters. Again, depends on the hardware you have and the # of non-zero elements in the input. but -q=1 is still the most recommended setting here.


On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov <dl...@gmail.com> wrote:
> you may try SSVD.
> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singular
> +Value+Decomposition
>
> but 4k eigenvectors (or, rather, singular values) is kind of still a 
> lot though and may push the precision out of the error estimates. I 
> don't we had precision study for that many. Also need quite a bit of 
> memory to compute that (not to mention flops). More realistically you 
> probably may try 1k singular values . You may try more if you have 
> access to more powerful hardware than we did in the studies but 
> distributed computation time will grow at about k^1.5, i.e. faster 
> than linear, even if you have enough nodes for the tasks.
>
> -d
>
> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak <t-...@expedia.com> wrote:
>> Hi,
>> I am working on a clustering problem which involves determining the 
>> largest "k" eigenvectors of a very large matrix. The matrices, I work 
>> on, are typically of the order of 10^6 by 10^6.
>> Trying to do this using the Lanczos solver available in Mahout, I 
>> found it is very slow and takes around 1.5 minutes to compute each eigenvectors.
>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>
>> So I am looking for something faster to solve the "Eigen decomposition"
>> problem for very large sparse matrix. Please suggest me what should I use ?
>>
>>
>> Thanks,
>> Aniruddha
>>

Re: eigendecomposition of very large matrices

Posted by Dmitriy Lyubimov <dl...@gmail.com>.
very significant sparsity may be a problem though for -q >=1
parameters. Again, depends on the hardware you have and the # of
non-zero elements in the input. but -q=1 is still the most recommended
setting here.


On Thu, Jul 19, 2012 at 6:20 PM, Dmitriy Lyubimov <dl...@gmail.com> wrote:
> you may try SSVD.
> https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singular+Value+Decomposition
>
> but 4k eigenvectors (or, rather, singular values) is kind of still a
> lot though and may push the precision out of the error estimates. I
> don't we had precision study for that many. Also need quite a bit of
> memory to compute that (not to mention flops). More realistically you
> probably may try 1k singular values . You may try more if you have
> access to more powerful hardware than we did in the studies but
> distributed computation time will grow at about k^1.5, i.e. faster
> than linear, even if you have enough nodes for the tasks.
>
> -d
>
> On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak <t-...@expedia.com> wrote:
>> Hi,
>> I am working on a clustering problem which involves determining the
>> largest "k" eigenvectors of a very large matrix. The matrices, I work on,
>> are typically of the order of 10^6 by 10^6.
>> Trying to do this using the Lanczos solver available in Mahout, I found it
>> is very slow and takes around 1.5 minutes to compute each eigenvectors.
>> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>>
>> So I am looking for something faster to solve the "Eigen decomposition"
>> problem for very large sparse matrix. Please suggest me what should I use ?
>>
>>
>> Thanks,
>> Aniruddha
>>

Re: eigendecomposition of very large matrices

Posted by Dmitriy Lyubimov <dl...@gmail.com>.
you may try SSVD.
https://cwiki.apache.org/confluence/display/MAHOUT/Stochastic+Singular+Value+Decomposition

but 4k eigenvectors (or, rather, singular values) is kind of still a
lot though and may push the precision out of the error estimates. I
don't we had precision study for that many. Also need quite a bit of
memory to compute that (not to mention flops). More realistically you
probably may try 1k singular values . You may try more if you have
access to more powerful hardware than we did in the studies but
distributed computation time will grow at about k^1.5, i.e. faster
than linear, even if you have enough nodes for the tasks.

-d

On Thu, Jul 19, 2012 at 6:12 PM, Aniruddha Basak <t-...@expedia.com> wrote:
> Hi,
> I am working on a clustering problem which involves determining the
> largest "k" eigenvectors of a very large matrix. The matrices, I work on,
> are typically of the order of 10^6 by 10^6.
> Trying to do this using the Lanczos solver available in Mahout, I found it
> is very slow and takes around 1.5 minutes to compute each eigenvectors.
> Hence to get 4000 eigenvectors, it takes 100 hours or 4 days !!
>
> So I am looking for something faster to solve the "Eigen decomposition"
> problem for very large sparse matrix. Please suggest me what should I use ?
>
>
> Thanks,
> Aniruddha
>