gov.sandia.cognition.learning.algorithm.clustering.divergence
Class CentroidClusterDivergenceFunction<DataType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.distance.DefaultDivergenceFunctionContainer<DataType,DataType>
          extended by gov.sandia.cognition.learning.algorithm.clustering.divergence.CentroidClusterDivergenceFunction<DataType>
Type Parameters:
DataType - The algorithm operates on a Collection<DataType>, so DataType will be something like Vector or String
All Implemented Interfaces:
ClusterDivergenceFunction<CentroidCluster<DataType>,DataType>, DivergenceFunctionContainer<DataType,DataType>, DivergenceFunction<CentroidCluster<DataType>,DataType>, CloneableSerializable, Serializable, Cloneable

@CodeReview(reviewer="Kevin R. Dixon",
            date="2008-07-23",
            changesNeeded=false,
            comments="Interface looks fine.")
public class CentroidClusterDivergenceFunction<DataType>
extends DefaultDivergenceFunctionContainer<DataType,DataType>
implements ClusterDivergenceFunction<CentroidCluster<DataType>,DataType>

The CentroidClusterDivergenceFunction class implements a divergence function between a cluster and an object by computing the divergence between the center of the cluster and the object.

Since:
1.0
Author:
Justin Basilico, Kevin R. Dixon
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gov.sandia.cognition.learning.function.distance.DefaultDivergenceFunctionContainer
divergenceFunction
 
Constructor Summary
CentroidClusterDivergenceFunction(DivergenceFunction<? super DataType,? super DataType> divergenceFunction)
          Creates a new instance of CentroidClusterDivergenceFunction.
 
Method Summary
 CentroidClusterDivergenceFunction<DataType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 double evaluate(CentroidCluster<DataType> cluster, DataType other)
          Evaluates the divergence between the cluster centroid and the given object.
 
Methods inherited from class gov.sandia.cognition.learning.function.distance.DefaultDivergenceFunctionContainer
getDivergenceFunction, setDivergenceFunction
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CentroidClusterDivergenceFunction

public CentroidClusterDivergenceFunction(DivergenceFunction<? super DataType,? super DataType> divergenceFunction)
Creates a new instance of CentroidClusterDivergenceFunction.

Parameters:
divergenceFunction - The divergenceFunction to use to compute distances.
Method Detail

clone

public CentroidClusterDivergenceFunction<DataType> clone()
Description copied from class: AbstractCloneableSerializable
This makes public the clone method on the Object class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call super.clone() to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in ObjectUtil may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use super.clone() as the basis for your implementation.

Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class DefaultDivergenceFunctionContainer<DataType,DataType>
Returns:
A clone of this object.

evaluate

public double evaluate(CentroidCluster<DataType> cluster,
                       DataType other)
Evaluates the divergence between the cluster centroid and the given object.

Specified by:
evaluate in interface DivergenceFunction<CentroidCluster<DataType>,DataType>
Parameters:
cluster - The cluster to compute distance from.
other - The object to compute the distance to.
Returns:
The divergence between the center of the cluster and the given object.