org.apache.mahout.clustering.kmeans
Class Cluster
java.lang.Object
org.apache.mahout.clustering.AbstractCluster
org.apache.mahout.clustering.DistanceMeasureCluster
org.apache.mahout.clustering.kmeans.Cluster
- All Implemented Interfaces:
- org.apache.hadoop.io.Writable, Cluster, Model<VectorWritable>
- Direct Known Subclasses:
- MeanShiftCanopy, SoftCluster
public class Cluster
- extends DistanceMeasureCluster
Constructor Summary |
Cluster()
For (de)serialization as a Writable |
Cluster(Vector center,
int clusterId,
DistanceMeasure measure)
Construct a new cluster with the given point as its center |
Methods inherited from class org.apache.mahout.clustering.AbstractCluster |
asFormatString, asJsonString, computeCentroid, computeParameters, count, formatVector, getCenter, getId, getNumPoints, getObservations, getRadius, getS0, getS1, getS2, observe, observe, observe, observe, setCenter, setId, setNumPoints, setRadius |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Cluster
public Cluster()
- For (de)serialization as a Writable
Cluster
public Cluster(Vector center,
int clusterId,
DistanceMeasure measure)
- Construct a new cluster with the given point as its center
- Parameters:
center
- the Vector centerclusterId
- the int cluster idmeasure
- a DistanceMeasure
formatCluster
public static java.lang.String formatCluster(Cluster cluster)
- Format the cluster for output
- Parameters:
cluster
- the Cluster
- Returns:
- the String representation of the Cluster
asFormatString
public java.lang.String asFormatString()
write
public void write(java.io.DataOutput out)
throws java.io.IOException
- Specified by:
write
in interface org.apache.hadoop.io.Writable
- Overrides:
write
in class DistanceMeasureCluster
- Throws:
java.io.IOException
readFields
public void readFields(java.io.DataInput in)
throws java.io.IOException
- Specified by:
readFields
in interface org.apache.hadoop.io.Writable
- Overrides:
readFields
in class DistanceMeasureCluster
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getIdentifier
public java.lang.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()
setConverged
protected void setConverged(boolean converged)
Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.