org.apache.mahout.clustering
Class ClusterBase

java.lang.Object
  extended by org.apache.mahout.clustering.ClusterBase
All Implemented Interfaces:
org.apache.hadoop.io.Writable, Printable
Direct Known Subclasses:
Canopy, Cluster, MeanShiftCanopy, SoftCluster

public abstract class ClusterBase
extends java.lang.Object
implements org.apache.hadoop.io.Writable, Printable


Constructor Summary
ClusterBase()
           
 
Method Summary
abstract  java.lang.String asFormatString()
          Deprecated.  
 java.lang.String asFormatString(java.lang.String[] bindings)
          Produce a custom, printable representation of the receiver.
 java.lang.String asJsonString()
          Produce a printable representation of the receiver using Json.
abstract  Vector computeCentroid()
           
static java.lang.String formatVector(Vector v, java.lang.String[] bindings)
          Return a human-readable formatted string representation of the vector, not intended to be complete nor usable as an input/output representation such as Json
 Vector getCenter()
           
 int getId()
           
abstract  java.lang.Object getIdentifier()
           
 int getNumPoints()
           
 Vector getPointTotal()
           
 void readFields(java.io.DataInput in)
          Reads in the id, nothing else
 void setCenter(Vector center)
           
 void setId(int id)
           
 void setNumPoints(int numPoints)
           
 void setPointTotal(Vector pointTotal)
           
 void write(java.io.DataOutput out)
          Simply writes out the id, and that's it!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterBase

public ClusterBase()
Method Detail

getId

public int getId()

setId

public void setId(int id)

getCenter

public Vector getCenter()

setCenter

public void setCenter(Vector center)

getNumPoints

public int getNumPoints()

setNumPoints

public void setNumPoints(int numPoints)

getPointTotal

public Vector getPointTotal()

setPointTotal

public void setPointTotal(Vector pointTotal)

asFormatString

@Deprecated
public abstract java.lang.String asFormatString()
Deprecated. 

Returns:

asFormatString

public java.lang.String asFormatString(java.lang.String[] bindings)
Description copied from interface: Printable
Produce a custom, printable representation of the receiver.

Specified by:
asFormatString in interface Printable
Parameters:
bindings - an optional String[] containing labels used to format the primary Vector/s of this implementation.
Returns:
a String

computeCentroid

public abstract Vector computeCentroid()

getIdentifier

public abstract java.lang.Object getIdentifier()

asJsonString

public java.lang.String asJsonString()
Description copied from interface: Printable
Produce a printable representation of the receiver using Json. (Label bindings are transient and not part of the Json representation)

Specified by:
asJsonString in interface Printable
Returns:
a Json String

write

public void write(java.io.DataOutput out)
           throws java.io.IOException
Simply writes out the id, and that's it!

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

readFields

public void readFields(java.io.DataInput in)
                throws java.io.IOException
Reads in the id, nothing else

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

formatVector

public static java.lang.String formatVector(Vector v,
                                            java.lang.String[] bindings)
Return a human-readable formatted string representation of the vector, not intended to be complete nor usable as an input/output representation such as Json

Parameters:
v - a Vector
Returns:
a String


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