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
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 |
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 |
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 centerclusterId
- the int cluster idmeasure
- a DistanceMeasure
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.