org.apache.mahout.clustering.fuzzykmeans
Class SoftCluster

java.lang.Object
  extended by org.apache.mahout.clustering.ClusterBase
      extended by org.apache.mahout.clustering.fuzzykmeans.SoftCluster
All Implemented Interfaces:
org.apache.hadoop.io.Writable, Printable

public class SoftCluster
extends ClusterBase


Constructor Summary
SoftCluster()
           
SoftCluster(java.lang.String clusterId)
          Construct a new softcluster with the given clusterID
SoftCluster(Vector center)
          Construct a new SoftCluster with the given point as its center
SoftCluster(Vector center, int clusterId)
          Construct a new SoftCluster with the given point as its center
 
Method Summary
 void addPoint(Vector point, double ptProb)
          Add the point to the SoftCluster
 void addPoints(Vector delta, double partialSumPtProb)
          Add the point to the cluster
 java.lang.String asFormatString()
           
 Vector computeCentroid()
          Compute the centroid
static SoftCluster decodeCluster(java.lang.String formattedString)
          Decodes and returns a SoftCluster from the formattedString
static java.lang.String formatCluster(SoftCluster cluster)
          Format the SoftCluster for output
 java.lang.String getIdentifier()
           
 double getPointProbSum()
           
 Vector getWeightedPointTotal()
           
 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.
 void setConverged(boolean converged)
           
 double std()
          Compute a "standard deviation" value to use as the "radius" of the cluster for display purposes
 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

SoftCluster

public SoftCluster()

SoftCluster

public SoftCluster(Vector center)
Construct a new SoftCluster with the given point as its center

Parameters:
center - the center point

SoftCluster

public SoftCluster(Vector center,
                   int clusterId)
Construct a new SoftCluster with the given point as its center

Parameters:
center - the center point

SoftCluster

public SoftCluster(java.lang.String clusterId)
Construct a new softcluster with the given clusterID

Method Detail

formatCluster

public static java.lang.String formatCluster(SoftCluster cluster)
Format the SoftCluster for output

Parameters:
cluster - the Cluster

decodeCluster

public static SoftCluster decodeCluster(java.lang.String formattedString)
Decodes and returns a SoftCluster from the formattedString

Parameters:
formattedString - a String produced by formatCluster

write

public void write(java.io.DataOutput out)
           throws java.io.IOException
Description copied from class: ClusterBase
Simply writes out the id, and that's it!

Specified by:
write in interface org.apache.hadoop.io.Writable
Overrides:
write in class ClusterBase
Parameters:
out - The DataOutput
Throws:
java.io.IOException

readFields

public void readFields(java.io.DataInput in)
                throws java.io.IOException
Description copied from class: ClusterBase
Reads in the id, nothing else

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

computeCentroid

public Vector computeCentroid()
Compute the centroid

Specified by:
computeCentroid in class ClusterBase
Returns:
the new centroid

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getIdentifier

public java.lang.String getIdentifier()
Specified by:
getIdentifier in class ClusterBase

std

public double std()
Compute a "standard deviation" value to use as the "radius" of the cluster for display purposes


addPoint

public void addPoint(Vector point,
                     double ptProb)
Add the point to the SoftCluster

Parameters:
point - a point to add

addPoints

public void addPoints(Vector delta,
                      double partialSumPtProb)
Add the point to the cluster

Parameters:
delta - a point to add

getPointProbSum

public double getPointProbSum()

recomputeCenter

public void recomputeCenter()
Compute the centroid and set the center to it.


getWeightedPointTotal

public Vector getWeightedPointTotal()

isConverged

public boolean isConverged()

setConverged

public void setConverged(boolean converged)

asFormatString

public java.lang.String asFormatString()
Specified by:
asFormatString in class ClusterBase
Returns:


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.