Home | About | Sematext search-lucene.com search-hadoop.com
 Search Lucene and all its subprojects:

Switch to Threaded View
Mahout, mail # user - Singular Value Decomposition does not return correct eigenvalues and -vectors


Copy link to this message
-
Re: Singular Value Decomposition does not return correct eigenvalues and -vectors
Dmitriy Lyubimov 2011-09-23, 23:42
oh, ok, apparently you need to use p>0.

but then there's a problem that ther's  k+p >=m (input height)
requirement so I guess this is a corner case i did not account for.

you can use k=2 and p=1 and caveat is that even though 3 singular
values will be computed, only 2 of them will be saved. this solver
always assumes "thin" decomposition requirement\s, although
distinction is purely technical, it is only a matter a patch to enable
p=0.

It is only a case because your input so small. In practice, input is
much "longer" than k+p rows so it hasn't come up as an issue. Point
is, it will not do full rank decomposition with small matrices; but
then, you don't want to use it with small matrices :)

alhough i can engineer a patch to allow p=0 and full rank
decompositions for short wide matrices if it is that important.

-dmitriy

On Fri, Sep 23, 2011 at 3:42 PM, Markus Holtermann
<[EMAIL PROTECTED]> wrote:
> Thank you for all your responses.
>
> ref. Dan Brickley:
> ------------------
> hopefully you did dream ;-)
>
> ref. Dmitriy Lyubimov:
> ----------------------
> When I run `mahout ssvd -i A.seq -o A-ssvd/ -k 3 -p 0` I get an
> IllegalArgumentException. You can find the traceback at
> http://paste.pocoo.org/show/481168/ .
>
> ref. Ted Dunning:
> -----------------
> I am running the M/R version of SVD in local mode. I didn't install
> Hadoop except what is coming via `mvn install`.
> If I understand the code correctly, the `--inMemory` argument is only
> relevant for the "EigenVerificationJob" -- I didn't run that.
>
> Here are the latest results for the calculations as described in my
> previous mail:
>
> For 1:
> Key class: class org.apache.hadoop.io.IntWritable
> Value Class: class org.apache.mahout.math.VectorWritable
> Key: 0: Value: eigenVector0, eigenvalue = 11.344411508600611:
> {0:0.8940505788976013,1:0.05761556873901637,2:-0.44424543735613486}
> Key: 1: Value: eigenVector1, eigenvalue = 0.0:
> {0:-0.3030457633656634,1:0.8081220356417685,2:-0.5050762722761053}
> Key: 2: Value: eigenVector2, eigenvalue = -0.4362482432944815:
> {0:0.3299042704770375,1:0.5861904313011974,2:0.7399621277956934}
> Count: 3
>
> For 2:
> Key class: class org.apache.hadoop.io.IntWritable
> Value Class: class org.apache.mahout.math.VectorWritable
> Key: 0: Value: eigenVector0, eigenvalue = 11.344814282762082:
> {0:0.7369762290995766,1:0.3279852776056837,2:-0.5910090485061045}
> Key: 1: Value: eigenVector1, eigenvalue = 0.17091518882717976:
> {0:0.9225878132457447,1:0.3812202473600341,2:0.05918487858557608}
> Key: 2: Value: eigenVector2, eigenvalue = 0.0:
> {0:-0.5910090485061055,1:0.7369762290995774,2:-0.3279852776056802}
> Key: 3: Value: eigenVector3, eigenvalue > -0.5157294715892533:{0:-0.32798527760568197,1:-0.5910090485061036,2:-0.7369762290995783}
> Count: 4
>
> For 3:
> Key class: class org.apache.hadoop.io.IntWritable
> Value Class: class org.apache.mahout.math.VectorWritable
> Key: 0: Value: eigenVector0, eigenvalue = 11.344814080004587:
> {0:0.2870124314018251,1:-0.8054865010309287,2:0.5184740696291035}
> Key: 1: Value: eigenVector1, eigenvalue = 0.4852290375835231:
> {0:0.9000472484774761,1:0.041469409433508436,2:-0.4338147514658307}
> Key: 2: Value: eigenVector2, eigenvalue = 0.0:
> {0:0.3279311127797073,1:0.5911613863727806,2:0.7368781449689461}
> Count: 3
>
> For 4:
> Key class: class org.apache.hadoop.io.IntWritable
> Value Class: class org.apache.mahout.math.VectorWritable
> Key: 0: Value: eigenVector0, eigenvalue = 11.34481428276208:
> {0:0.788451139115581,1:0.5058848349238699,2:0.3498933194866569}
> Key: 1: Value: eigenVector1, eigenvalue = 0.5157294715892401:
> {0:-0.5910090485061453,1:0.7369762290995597,2:-0.32798527760564816}
> Key: 2: Value: eigenVector2, eigenvalue = 0.1709151888272022:
> {0:-0.7369762290995447,1:-0.3279852776057236,2:0.5910090485061223}
> Key: 3: Value: eigenVector3, eigenvalue = 0.0:
> {0:-0.3279852776056819,1:-0.5910090485061036,2:-0.7369762290995783}
> Count: 4
>
> For 5: