org.apache.mahout.clustering.meanshift
Class MeanShiftCanopy

java.lang.Object
  extended by org.apache.mahout.clustering.AbstractCluster
      extended by org.apache.mahout.clustering.DistanceMeasureCluster
          extended by org.apache.mahout.clustering.kmeans.Cluster
              extended by org.apache.mahout.clustering.meanshift.MeanShiftCanopy
All Implemented Interfaces:
org.apache.hadoop.io.Writable, Cluster, Model<VectorWritable>, Parametered

public class MeanShiftCanopy
extends Cluster

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.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.mahout.common.parameters.Parametered
Parametered.ParameteredGeneralizations
 
Field Summary
 
Fields inherited from interface org.apache.mahout.clustering.Cluster
CLUSTERED_POINTS_DIR, CLUSTERS_DIR, FINAL_ITERATION_SUFFIX, INITIAL_CLUSTERS_DIR
 
Fields inherited from interface org.apache.mahout.common.parameters.Parametered
log
 
Constructor Summary
MeanShiftCanopy()
          Used for Writable
MeanShiftCanopy(Vector point, int id, DistanceMeasure measure)
          Create a new Canopy containing the given point
 
Method Summary
 String asFormatString()
           
 org.apache.mahout.math.list.IntArrayList getBoundPoints()
           
 String getIdentifier()
           
 int getMass()
           
static MeanShiftCanopy initialCanopy(Vector point, int id, DistanceMeasure measure)
          Create an initial Canopy, retaining the original type of the given point (e.g.
 double pdf(VectorWritable vw)
          Return the probability that the observation is described by this model
 void readFields(DataInput in)
           
 void setBoundPoints(org.apache.mahout.math.list.IntArrayList boundPoints)
           
 MeanShiftCanopy shallowCopy()
           
 void write(DataOutput out)
           
 
Methods inherited from class org.apache.mahout.clustering.kmeans.Cluster
computeConvergence, formatCluster, isConverged, setConverged, toString
 
Methods inherited from class org.apache.mahout.clustering.DistanceMeasureCluster
configure, getMeasure, sampleFromPosterior, setMeasure
 
Methods inherited from class org.apache.mahout.clustering.AbstractCluster
asFormatString, computeCentroid, computeParameters, count, createParameters, formatVector, getCenter, getId, getNumPoints, getObservations, getParameters, getRadius, getS0, getS1, getS2, observe, observe, observe, observe, observe, observe, setCenter, setId, setNumPoints, setRadius, setS0, setS1, setS2
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MeanShiftCanopy

public MeanShiftCanopy()
Used for Writable


MeanShiftCanopy

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

Parameters:
point - a Vector
id - an int canopy id
measure - a DistanceMeasure
Method Detail

getMass

public int getMass()

initialCanopy

public static MeanShiftCanopy initialCanopy(Vector point,
                                            int id,
                                            DistanceMeasure measure)
Create an initial Canopy, retaining the original type of the given point (e.g. NamedVector)

Parameters:
point - a Vector
id - an int
measure - a DistanceMeasure
Returns:
a MeanShiftCanopy

getBoundPoints

public org.apache.mahout.math.list.IntArrayList getBoundPoints()

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Overrides:
readFields in class Cluster
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Overrides:
write in class Cluster
Throws:
IOException

shallowCopy

public MeanShiftCanopy shallowCopy()

asFormatString

public String asFormatString()
Overrides:
asFormatString in class Cluster

setBoundPoints

public void setBoundPoints(org.apache.mahout.math.list.IntArrayList boundPoints)

getIdentifier

public String getIdentifier()
Overrides:
getIdentifier in class Cluster

pdf

public double pdf(VectorWritable vw)
Description copied from interface: Model
Return the probability that the observation is described by this model

Specified by:
pdf in interface Model<VectorWritable>
Overrides:
pdf in class DistanceMeasureCluster
Parameters:
vw - an Observation from the posterior
Returns:
the probability that x is in the receiver


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