## org.apache.mahout.clustering.kmeans
Class Kluster

    java.lang.Object
      org.apache.mahout.clustering.AbstractCluster
          org.apache.mahout.clustering.iterator.DistanceMeasureCluster
              org.apache.mahout.clustering.kmeans.Kluster

All Implemented Interfaces:
  org.apache.hadoop.io.Writable, Cluster, Model<VectorWritable>, Parametered

Direct Known Subclasses:
  SoftCluster

    public class Kluster

extends DistanceMeasureCluster

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.mahout.common.parameters.Parametered
`Parametered.ParameteredGeneralizations`

Field Summary

Fields inherited from interface org.apache.mahout.clustering.Cluster
`CLUSTERED_POINTS_DIR, CLUSTERS_DIR, FINAL_ITERATION_SUFFIX, INITIAL_CLUSTERS_DIR`

Fields inherited from interface org.apache.mahout.common.parameters.Parametered
`log`

Constructor Summary
`Kluster()` For (de)serialization as a Writable
`Kluster(Vector center, int clusterId, DistanceMeasure measure)` Construct a new cluster with the given point as its center

Method Summary
`String` `asFormatString()`
`boolean` `calculateConvergence(double convergenceDelta)`
`boolean` `computeConvergence(DistanceMeasure measure, double convergenceDelta)` Return if the cluster is converged by comparing its center and centroid.
`static String` `formatCluster(Kluster cluster)` Format the cluster for output
`String` `getIdentifier()`
`boolean` `isConverged()`
`void` `readFields(DataInput in)`
`protected void` `setConverged(boolean converged)`
`String` `toString()`
`void` `write(DataOutput out)`

Methods inherited from class org.apache.mahout.clustering.iterator.DistanceMeasureCluster
`configure, getMeasure, pdf, sampleFromPosterior, setMeasure`

Methods inherited from class org.apache.mahout.clustering.AbstractCluster
`asFormatString, computeCentroid, computeParameters, createParameters, formatVector, getCenter, getId, getNumObservations, getParameters, getRadius, getS0, getS1, getS2, getTotalObservations, observe, observe, observe, observe, observe, setCenter, setId, setNumObservations, setRadius, setS0, setS1, setS2, setTotalObservations`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Kluster

    public Kluster()

  For (de)serialization as a Writable

### Kluster

    public Kluster(Vector center,
                   int clusterId,
                   DistanceMeasure measure)

  Construct a new cluster with the given point as its center

  Parameters:
    `center` - the Vector center
    `clusterId` - the int cluster id
    `measure` - a DistanceMeasure

Method Detail

### formatCluster

    public static String formatCluster(Kluster cluster)

  Format the cluster for output

  Parameters:
    `cluster` - the Cluster
  Returns:
    the String representation of the Cluster

### asFormatString

    public String asFormatString()

### write

    public void write(DataOutput out)
               throws IOException

  Specified by:
    `write` in interface `org.apache.hadoop.io.Writable`
  Overrides:
    `write` in class `DistanceMeasureCluster`
  Throws:
    `IOException`

### readFields

    public void readFields(DataInput in)
                    throws IOException

  Specified by:
    `readFields` in interface `org.apache.hadoop.io.Writable`
  Overrides:
    `readFields` in class `DistanceMeasureCluster`
  Throws:
    `IOException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### getIdentifier

    public String getIdentifier()

  Overrides:
    `getIdentifier` in class `DistanceMeasureCluster`

### computeConvergence

    public boolean computeConvergence(DistanceMeasure measure,
                                      double convergenceDelta)

  Return if the cluster is converged by comparing its center and centroid.

  Parameters:
    `measure` - The distance measure to use for cluster-point comparisons.
    `convergenceDelta` - the convergence delta to use for stopping.
  Returns:
    if the cluster is converged

### isConverged

    public boolean isConverged()

  Specified by:
    `isConverged` in interface `Cluster`
  Overrides:
    `isConverged` in class `AbstractCluster`
  Returns:
    if the receiver has converged, or false if that has no meaning for the implementation

### setConverged

    protected void setConverged(boolean converged)

### calculateConvergence

    public boolean calculateConvergence(double convergenceDelta)

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.