mahout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Anil <>
Subject Re: Fuzzy K Means
Date Tue, 16 Feb 2010 16:58:34 GMT
On Tue, Feb 16, 2010 at 10:25 PM, Jeff Eastman

> Looks to me like the unit tests are the only calls to recomputeCenter,
> which is where the center is set. The clusterer seems to be calling
> computeCentroid, which sets the centroid, instead. I'm not sure why it needs
> both instance variables, as the pointProbSum and weightedPointTotal
> variables take the place of the single pointTotal in ClusterBase. I think
> perhaps center and centroid need to be merged?
> In k-means and canopy, the center is the (read-only) current centroid which
> is used for the distance calculations during an iteration, and it is
> recomputed by computeCentroid (using pointTotal and numPoints) at the end of
> the iteration.
> So just writing computeCentroid should do right? Which is what its doing.

  public void write(DataOutput out) throws IOException {
    Vector vector = computeCentroid();
    VectorWritable.writeVector(out, vector);

  public void readFields(DataInput in) throws IOException {
    clusterId = in.readInt();
    converged = in.readBoolean();
    VectorWritable temp = new VectorWritable();
    this.pointProbSum = 0;
    this.weightedPointTotal = getCenter().like();

> Robin Anil wrote:
>> I have been trying to convert FuzzyKMeans SoftCluster(which should be
>> ideally be named FuzzyKmeansCluster) to use the ClusterBase.
>> I am getting* the same center* for all the clusters. To aid the conversion
>> all i did was remove the center vector from the SoftCluster class and
>> reuse
>> the same from the ClusterBase. These are essentially making no change in
>> the
>> tests which passes correctly.
>> So I am questioning whether the implementation keeps the average center at
>> all ? Anyone who has used FuzzyKMeans experiencing this?
>> Robin

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message