You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by "DeBarr, Dave" <de...@mitre.org> on 2013/11/03 19:30:44 UTC

AbstractCluster() constructor

Hi,

Curiosity question: why not use point.clone() in the constructor for org.apache.mahout.clustering.AbstractCluster()?

This would allow the use of DenseVector, which is much faster (no dictionary lookups) when clustering dense SIFT descriptors to form visual words (instead of sparse document vectors).

Thanks,
Dave

  protected AbstractCluster(Vector point, int id2) {
    setNumObservations(0);
    setTotalObservations(0);
  //setCenter(new RandomAccessSparseVector(point));
    setCenter(point.clone());
    setRadius(center.like());
    setS0(0);
    setS1(center.like());
    setS2(center.like());
    this.id = id2;
  }



Re: AbstractCluster() constructor

Posted by Jeff Eastman <je...@windwardsolutions.com>.
I can't think of a good reason not to do this, but I've not been in that code for a while. If you make that change, do all of the unit tests still run? Can you write another test that uses DenseVectors? If yes, then please submit a JIRA patch.

Jeff


On Nov 3, 2013, at 1:30 PM, "DeBarr, Dave" <de...@mitre.org> wrote:

> Hi,
> 
> Curiosity question: why not use point.clone() in the constructor for org.apache.mahout.clustering.AbstractCluster()?
> 
> This would allow the use of DenseVector, which is much faster (no dictionary lookups) when clustering dense SIFT descriptors to form visual words (instead of sparse document vectors).
> 
> Thanks,
> Dave
> 
>  protected AbstractCluster(Vector point, int id2) {
>    setNumObservations(0);
>    setTotalObservations(0);
>  //setCenter(new RandomAccessSparseVector(point));
>    setCenter(point.clone());
>    setRadius(center.like());
>    setS0(0);
>    setS1(center.like());
>    setS2(center.like());
>    this.id = id2;
>  }
> 
>