org.apache.mahout.clustering.meanshift
Class MeanShiftCanopy

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

public class MeanShiftCanopy
extends ClusterBase

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
MeanShiftCanopy()
           
MeanShiftCanopy(Vector point, int id)
          Create a new Canopy containing the given point
 
Method Summary
 java.lang.String asFormatString()
           
 Vector computeCentroid()
          Compute the centroid by normalizing the pointTotal
static MeanShiftCanopy decodeCanopy(java.lang.String formattedString)
          Decodes and returns a Canopy from the formattedString
static java.lang.String formatCanopy(MeanShiftCanopy canopy)
          Format the canopy for output
 IntArrayList getBoundPoints()
           
 int getCanopyId()
           
 java.lang.String getIdentifier()
           
 boolean isConverged()
           
 void readFields(java.io.DataInput in)
          Reads in the id, nothing else
 void setBoundPoints(IntArrayList boundPoints)
           
 void setConverged(boolean converged)
           
 MeanShiftCanopy shallowCopy()
           
 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

MeanShiftCanopy

public MeanShiftCanopy()

MeanShiftCanopy

public MeanShiftCanopy(Vector point,
                       int id)
Create a new Canopy containing the given point

Parameters:
point - a Vector
Method Detail

computeCentroid

public Vector computeCentroid()
Compute the centroid by normalizing the pointTotal

Specified by:
computeCentroid in class ClusterBase
Returns:
a Vector which is the new centroid

getBoundPoints

public IntArrayList getBoundPoints()

getCanopyId

public int getCanopyId()

getIdentifier

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

isConverged

public boolean isConverged()

toString

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

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

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

shallowCopy

public MeanShiftCanopy shallowCopy()

asFormatString

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

setBoundPoints

public void setBoundPoints(IntArrayList boundPoints)

setConverged

public void setConverged(boolean converged)

formatCanopy

public static java.lang.String formatCanopy(MeanShiftCanopy canopy)
Format the canopy for output


decodeCanopy

public static MeanShiftCanopy decodeCanopy(java.lang.String formattedString)
Decodes and returns a Canopy from the formattedString

Parameters:
formattedString - a String produced by formatCanopy
Returns:
a new Canopy


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