[ 
https://issues.apache.org/jira/browse/MAHOUT-1157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13598630#comment-13598630
 ] 

Sebastian Schelter commented on MAHOUT-1157:
--------------------------------------------

Thanks for pointing us, there are much more problems in that code...

{code}
    int nzero = 0;
    Iterator<Vector.Element> iterateNonZero = v.iterateNonZero();
    while (iterateNonZero.hasNext()) {
      iterateNonZero.next();
      nzero++;
    }
{code}

can be replaced by v.getNumNonDefaultElements() for example...
                
> AbstractCluster.formatVector iteration bug.
> -------------------------------------------
>
>                 Key: MAHOUT-1157
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-1157
>             Project: Mahout
>          Issue Type: Bug
>          Components: Clustering
>    Affects Versions: 0.7
>            Reporter: Adam Bozanich
>         Attachments: mahout.patch
>
>
> AbstractCluster.formatVector's use of the size field of the given vector 
> causes problems when the vector is sparse.
> I clustered a handful of vectors which had been initialized with a 
> cardinality of Integer.MAX_VALUE. Running seqdump on the resulting 
> clusteredPoints took over four minutes.  This is because formatVector() was 
> iterating over the entire integer space for every vector.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to