You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Anna Lahoud <an...@gmail.com> on 2012/09/08 00:49:25 UTC

RowSimilarity incorrectly setting 'size'

I am running a RowSimilarityJob with a large dataset. When I call
Vector.size() on the resulting vector, it always returns Integer.MAX_VALUE.
At first I thought maybe I really did end up with a cardinality that
outsized the int. Upon further checking, I found that the rowid vector
cardinality was correct. It is only the vectors after the RowId job that
have an invalid size.

I did some looking into the job's temp directory (which in my Mahout V0.6
still exists after the job). Both the cooccurrence and the weight outputs
are also set to size=Integer.MAX_VALUE.

In searching for the problem, I found that the VectorNormMapper, which is
the first of three job that run, the vector is created with the following
line:

RandomAccessSparseVector partialColumnVector = new
RandomAccessSparseVector(Integer.MAX_VALUE);

which sets the size for the vector to the Integer.MAX_VALUE. I believe that
is then carried through to the remaining vectors throughout the jobs.

I don't know if this is a known bug or not.

Thanks,

Anna

Re: RowSimilarity incorrectly setting 'size'

Posted by Sean Owen <sr...@gmail.com>.
Yes, the indices of the vector are item IDs, which in theory can take
on any value. In practice that's limited to the range of longs in
Java. And in more practice, that's limited to the range of
nonnnegative ints since they are used as Vector indices. This is why
the dimensionality is conceptually infinite, and set to
Integer.MAX_VALUE in practice.

On Fri, Sep 7, 2012 at 11:49 PM, Anna Lahoud <an...@gmail.com> wrote:
> I am running a RowSimilarityJob with a large dataset. When I call
> Vector.size() on the resulting vector, it always returns Integer.MAX_VALUE.
> At first I thought maybe I really did end up with a cardinality that
> outsized the int. Upon further checking, I found that the rowid vector
> cardinality was correct. It is only the vectors after the RowId job that
> have an invalid size.
>
> I did some looking into the job's temp directory (which in my Mahout V0.6
> still exists after the job). Both the cooccurrence and the weight outputs
> are also set to size=Integer.MAX_VALUE.
>
> In searching for the problem, I found that the VectorNormMapper, which is
> the first of three job that run, the vector is created with the following
> line:
>
> RandomAccessSparseVector partialColumnVector = new
> RandomAccessSparseVector(Integer.MAX_VALUE);
>
> which sets the size for the vector to the Integer.MAX_VALUE. I believe that
> is then carried through to the remaining vectors throughout the jobs.
>
> I don't know if this is a known bug or not.
>
> Thanks,
>
> Anna