|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.clustering.ClusterBase
org.apache.mahout.clustering.kmeans.Cluster
public class Cluster
Constructor Summary | |
---|---|
Cluster()
For (de)serialization as a Writable |
|
Cluster(java.lang.String clusterId)
Construct a new clsuter with the given id as identifier |
|
Cluster(Vector center)
Construct a new cluster with the given point as its center |
|
Cluster(Vector center,
int clusterId)
Construct a new cluster with the given point as its center |
Method Summary | |
---|---|
void |
addPoint(Vector point)
Add the point to the cluster |
void |
addPoints(int count,
Vector delta)
Add the point to the cluster |
java.lang.String |
asFormatString()
|
Vector |
computeCentroid()
Compute the centroid by averaging the pointTotals |
boolean |
computeConvergence(DistanceMeasure measure,
double convergenceDelta)
Return if the cluster is converged by comparing its center and centroid. |
static Cluster |
decodeCluster(java.lang.String formattedString)
Decodes and returns a Cluster from the formattedString. |
static java.lang.String |
formatCluster(Cluster cluster)
Format the cluster for output |
java.lang.String |
getIdentifier()
|
double |
getStd()
|
boolean |
isConverged()
|
void |
readFields(java.io.DataInput in)
Reads in the id, nothing else |
void |
recomputeCenter()
Compute the centroid and set the center to it. |
java.lang.String |
toString()
|
void |
write(java.io.DataOutput out)
Simply writes out the id, and that's it! |
Methods inherited from class org.apache.mahout.clustering.ClusterBase |
---|
asFormatString, asJsonString, formatVector, getCenter, getId, getNumPoints, getPointTotal, setCenter, setId, setNumPoints, setPointTotal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Cluster(Vector center)
center
- the center pointpublic Cluster()
public Cluster(Vector center, int clusterId)
center
- the center pointpublic Cluster(java.lang.String clusterId)
Method Detail |
---|
public static java.lang.String formatCluster(Cluster cluster)
cluster
- the Cluster
public java.lang.String asFormatString()
asFormatString
in class ClusterBase
public static Cluster decodeCluster(java.lang.String formattedString)
formattedString
- a String produced by formatCluster
java.lang.IllegalArgumentException
- when the string is wrongly formattedpublic void write(java.io.DataOutput out) throws java.io.IOException
ClusterBase
write
in interface org.apache.hadoop.io.Writable
write
in class ClusterBase
out
- The DataOutput
java.io.IOException
public void readFields(java.io.DataInput in) throws java.io.IOException
ClusterBase
readFields
in interface org.apache.hadoop.io.Writable
readFields
in class ClusterBase
java.io.IOException
public Vector computeCentroid()
computeCentroid
in class ClusterBase
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getIdentifier()
getIdentifier
in class ClusterBase
public void addPoint(Vector point)
point
- a point to addpublic void addPoints(int count, Vector delta)
count
- the number of points in the deltadelta
- a point to addpublic void recomputeCenter()
public boolean computeConvergence(DistanceMeasure measure, double convergenceDelta)
measure
- The distance measure to use for cluster-point comparisons.convergenceDelta
- the convergence delta to use for stopping.
public boolean isConverged()
public double getStd()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |