|
||||||||||
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.canopy.Canopy
public class Canopy
This class models a canopy as a center point, the number of points that are contained within it according to the application of some distance metric, and a point total which is the sum of all the points and is used to compute the centroid when needed.
Constructor Summary | |
---|---|
Canopy()
Used for deserializaztion as a writable |
|
Canopy(Vector point,
int canopyId)
Create a new Canopy containing the given point and canopyId |
Method Summary | |
---|---|
void |
addPoint(Vector point)
Add a point to the canopy |
java.lang.String |
asFormatString()
|
Vector |
computeCentroid()
Compute the centroid by averaging the pointTotals |
static Canopy |
decodeCanopy(java.lang.String formattedString)
Decodes and returns a Canopy from the formattedString |
void |
emitPoint(Vector point,
org.apache.hadoop.mapred.OutputCollector<org.apache.hadoop.io.Text,Vector> collector)
Emit the point to the collector, keyed by the canopy's formatted representation |
static java.lang.String |
formatCanopy(Canopy canopy)
Format the canopy for output |
java.lang.String |
getIdentifier()
|
void |
readFields(java.io.DataInput in)
Reads in the id, nothing else |
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 Canopy()
public Canopy(Vector point, int canopyId)
point
- a point in vector spacecanopyId
- an int identifying the canopy local to this process onlyMethod Detail |
---|
public 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 static java.lang.String formatCanopy(Canopy canopy)
public java.lang.String asFormatString()
asFormatString
in class ClusterBase
public static Canopy decodeCanopy(java.lang.String formattedString)
formattedString
- a String prouced by formatCanopy
public void addPoint(Vector point)
point
- some point to addpublic void emitPoint(Vector point, org.apache.hadoop.mapred.OutputCollector<org.apache.hadoop.io.Text,Vector> collector) throws java.io.IOException
point
- a point to emit.
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getIdentifier()
getIdentifier
in class ClusterBase
public Vector computeCentroid()
computeCentroid
in class ClusterBase
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |