gov.sandia.cognition.learning.algorithm.clustering.cluster
Class VectorMeanCentroidClusterCreator

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.algorithm.clustering.cluster.VectorMeanCentroidClusterCreator
All Implemented Interfaces:
ClusterCreator<CentroidCluster<Vector>,Vector>, IncrementalClusterCreator<CentroidCluster<Vector>,Vector>, CloneableSerializable, Serializable, Cloneable

@CodeReview(reviewer="Kevin R. Dixon",
            date="2008-07-22",
            changesNeeded=false,
            comments="Code generally looks fine.")
public class VectorMeanCentroidClusterCreator
extends AbstractCloneableSerializable
implements IncrementalClusterCreator<CentroidCluster<Vector>,Vector>

The VectorMeanCentroidClusterCreator class implements a cluster creator for centroid clusters where the centroid is the mean of the vectors that are members of the cluster.

Since:
1.0
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
static VectorMeanCentroidClusterCreator INSTANCE
          An instance of this class since it has no internal data.
 
Constructor Summary
VectorMeanCentroidClusterCreator()
          Creates a new instance of VectorMeanCentroidClusterCreator
 
Method Summary
 void addClusterMember(CentroidCluster<Vector> cluster, Vector member)
          Adds a member to the given cluster.
 CentroidCluster<Vector> createCluster()
          Creates a new, empty cluster.
 CentroidCluster<Vector> createCluster(Collection<Vector> members)
          Create a new cluster from the given members of that cluster.
 boolean removeClusterMember(CentroidCluster<Vector> cluster, Vector member)
          Removes a member from the given cluster.
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Field Detail

INSTANCE

public static final VectorMeanCentroidClusterCreator INSTANCE
An instance of this class since it has no internal data.

Constructor Detail

VectorMeanCentroidClusterCreator

public VectorMeanCentroidClusterCreator()
Creates a new instance of VectorMeanCentroidClusterCreator

Method Detail

createCluster

public CentroidCluster<Vector> createCluster()
Description copied from interface: IncrementalClusterCreator
Creates a new, empty cluster.

Specified by:
createCluster in interface IncrementalClusterCreator<CentroidCluster<Vector>,Vector>
Returns:
A new, empty cluster.

createCluster

public CentroidCluster<Vector> createCluster(Collection<Vector> members)
Description copied from interface: ClusterCreator
Create a new cluster from the given members of that cluster.

Specified by:
createCluster in interface ClusterCreator<CentroidCluster<Vector>,Vector>
Parameters:
members - The members of the cluster.
Returns:
A new cluster created from the given members.

addClusterMember

public void addClusterMember(CentroidCluster<Vector> cluster,
                             Vector member)
Description copied from interface: IncrementalClusterCreator
Adds a member to the given cluster.

Specified by:
addClusterMember in interface IncrementalClusterCreator<CentroidCluster<Vector>,Vector>
Parameters:
cluster - The cluster to add a member to.
member - The member to add to the cluster.

removeClusterMember

public boolean removeClusterMember(CentroidCluster<Vector> cluster,
                                   Vector member)
Description copied from interface: IncrementalClusterCreator
Removes a member from the given cluster.

Specified by:
removeClusterMember in interface IncrementalClusterCreator<CentroidCluster<Vector>,Vector>
Parameters:
cluster - The cluster to remove the member from.
member - The member to remove.
Returns:
True if the member was successfully removed. False if there was an error, such as the member not actually being in the cluster to start with.