mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lastarsenal <lastarse...@163.com>
Subject Re:回复: Re:some confuse about SSVD in class ABtDenseOutJob
Date Thu, 21 May 2015 10:33:50 GMT
VectorWritable need to set a Vector instance. Vector is a abstract class, so you should know
what is the real Vector class in details. for example, it may be RandomAccessSparseVector


the index() method return the itemID, it should NOT exceed vector size.

At 2015-05-21 18:01:23, "zhonghongfei@yy.com" <zhonghongfei@yy.com> wrote:
>hi  lastarsenal, thank you for your reply
>First of all, the input to ABtDenseOutJob is a rating matrix, where row key is item id
and value is VectorWritable, I want to know if the input format is right or not ?
>And then if it's right, so definitely the code below :
>
>int i = vecEl.index();
>
>i will be the item id and it may larger than the vector size , so I think it's some kind
of bug or I can't quite understand the orginal logic
>
>------------------------------------------------------------------------------------------------
>Hi, HongFei,
> 
> 
>   
>   You can print some variable like aRowCount, vecSize to check whey ArrayIndexOutOfBoundsException
> 
> 
> 
>At 2015-05-21 15:30:23, "zhonghongfei@yy.com" <zhonghongfei@yy.com> wrote:
>>I've run the SSVDCLI with "-q 1" parameter, but I've got an java.lang.ArrayIndexOutOfBoundsException.

>>
>>I found that it's because when it's not a dense vector, i is the index of an Vector.Element
and this index is an item id,so it exceeds the vector size.
>>My question is if there is a bug in ABtDenseOutJob?
>>
>>the following code is in ABtDenseOutJob --> ABtMapper --> map() : 
>>
>>if (vec.isDense()) { 
>>for (int i = 0; i < vecSize; i++) { 
>>extendAColIfNeeded(i, aRowCount + 1); 
>>aCols[i].setQuick(aRowCount, vec.getQuick(i)); 
>>} 
>>} else if (vec.size() > 0) { 
>>for (Vector.Element vecEl : vec.nonZeroes()) { 
>>int i = vecEl.index(); // i is item id , so it will exceed the vec.size() usually,
when extendAColIfNeeded(i, aRowCount + 1) is called it will get an error
>>extendAColIfNeeded(i, aRowCount + 1); 
>>aCols[i].setQuick(aRowCount, vecEl.get()); 
>>} 
>>}
>>
>>So how to fix this proplem ?
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message