gov.sandia.cognition.learning.function.cost
Class ClusterDistortionMeasure<DataType,ClusterType extends Cluster<DataType>>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.cost.ClusterDistortionMeasure<DataType,ClusterType>
Type Parameters:
DataType - Type of data to compute the distortion over
ClusterType - Type of clusters to use
All Implemented Interfaces:
Evaluator<Collection<? extends ClusterType>,Double>, CostFunction<Collection<? extends ClusterType>,ClusterDivergenceFunction<? super ClusterType,? super DataType>>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
ParallelClusterDistortionMeasure

@PublicationReference(author="Christopher M. Bishop",
                      title="Pattern Recognition and Machine Learning",
                      type=Book,
                      year=2006,
                      pages={424,428},
                      notes="Section 9.1",
                      url="http://research.microsoft.com/~cmbishop/PRML/")
public class ClusterDistortionMeasure<DataType,ClusterType extends Cluster<DataType>>
extends AbstractCloneableSerializable
implements CostFunction<Collection<? extends ClusterType>,ClusterDivergenceFunction<? super ClusterType,? super DataType>>

Computes the objective measure for a clustering algorithm, based on the internal "distortion" of each cluster. The individual cluster measures are based on a ClusterDivergenceFunction and summed over each cluster.

Since:
3.0
Author:
Kevin R. Dixon
See Also:
ClusterDivergenceFunction, Serialized Form

Constructor Summary
ClusterDistortionMeasure()
          Creates a new instance of ClusterDistortionMeasure
ClusterDistortionMeasure(ClusterDivergenceFunction<ClusterType,DataType> costParameters)
          Creates a new instance of ClusterDistortionMeasure
 
Method Summary
 ClusterDistortionMeasure<DataType,ClusterType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 Double evaluate(ClusterType cluster)
          Evaluates the distortion for a single cluster
 Double evaluate(Collection<? extends ClusterType> target)
          Computes the cost of the given target.
 ClusterDivergenceFunction<? super ClusterType,? super DataType> getCostParameters()
          Gets the parameters of the cost function.
 void setCostParameters(ClusterDivergenceFunction<? super ClusterType,? super DataType> costParameters)
          Sets the parameters of the cost function used to evaluate the cost of a target.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterDistortionMeasure

public ClusterDistortionMeasure()
Creates a new instance of ClusterDistortionMeasure


ClusterDistortionMeasure

public ClusterDistortionMeasure(ClusterDivergenceFunction<ClusterType,DataType> costParameters)
Creates a new instance of ClusterDistortionMeasure

Parameters:
costParameters - Divergence function that defines the cost function
Method Detail

clone

public ClusterDistortionMeasure<DataType,ClusterType> 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 CostFunction<Collection<? extends ClusterType extends Cluster<DataType>>,ClusterDivergenceFunction<? super ClusterType extends Cluster<DataType>,? super DataType>>
Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractCloneableSerializable
Returns:
A clone of this object.

evaluate

public Double evaluate(Collection<? extends ClusterType> target)
Description copied from interface: CostFunction
Computes the cost of the given target.

Specified by:
evaluate in interface Evaluator<Collection<? extends ClusterType extends Cluster<DataType>>,Double>
Specified by:
evaluate in interface CostFunction<Collection<? extends ClusterType extends Cluster<DataType>>,ClusterDivergenceFunction<? super ClusterType extends Cluster<DataType>,? super DataType>>
Parameters:
target - The object to evaluate.
Returns:
The cost of the given object.

evaluate

public Double evaluate(ClusterType cluster)
Evaluates the distortion for a single cluster

Parameters:
cluster - Cluster to consider
Returns:
Distortion for a single member

getCostParameters

public ClusterDivergenceFunction<? super ClusterType,? super DataType> getCostParameters()
Description copied from interface: CostFunction
Gets the parameters of the cost function.

Specified by:
getCostParameters in interface CostFunction<Collection<? extends ClusterType extends Cluster<DataType>>,ClusterDivergenceFunction<? super ClusterType extends Cluster<DataType>,? super DataType>>
Returns:
The current parameters of the cost function.

setCostParameters

public void setCostParameters(ClusterDivergenceFunction<? super ClusterType,? super DataType> costParameters)
Description copied from interface: CostFunction
Sets the parameters of the cost function used to evaluate the cost of a target.

Specified by:
setCostParameters in interface CostFunction<Collection<? extends ClusterType extends Cluster<DataType>>,ClusterDivergenceFunction<? super ClusterType extends Cluster<DataType>,? super DataType>>
Parameters:
costParameters - The parameters of the cost function.