Package com.chemaxon.clustering.wards
Class LanceWilliamsAlgorithm
java.lang.Object
com.chemaxon.clustering.wards.LanceWilliamsAlgorithm
Agglomerative hierarchical clustering implementation for Lance-Williams algorithm family.
Licensing: this class is part of the JKlustor suite; it can be used with valid
JKlustor
license.
Please note that this class is marked with @Beta annotation, so it can be subject of incompatible changes or removal in later releases.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double[][]
Distance matrix calculation.static IDBasedHierarchicClustering
cluster
(double[][] dissim, LanceWilliamsMerge merge, ProgressObserver po) Invoke clustering.static IDBasedHierarchicClustering
cluster
(DissimilarityInput input, LanceWilliamsMerge merge, PhasedProgressObserver ppo) Invoke clustering.
-
Method Details
-
calculateDissimilarityMatrix
public static double[][] calculateDissimilarityMatrix(DissimilarityInput input, ProgressObserver po) Distance matrix calculation.- Parameters:
input
- Input dissimilarity spacepo
- Progress observer- Returns:
- Distance matrix, with
[<TARGET>][<QUERY>]
indices
-
cluster
public static IDBasedHierarchicClustering cluster(DissimilarityInput input, LanceWilliamsMerge merge, PhasedProgressObserver ppo) throws CancellationException Invoke clustering.The current implementation requires O(n2) storage and O(n2) pairwise input comparison invocation. Over the stored dissimilarity values it requires O(n3) simple numerical comparison steps.
- Parameters:
input
- Input dissimilarity spacemerge
- Cluster distance update functionppo
- Observing progress observer. TwoPhasedProgressObserver.phase(String)
will be associated to the distance matrix calculation and to the clustering iterations- Returns:
- Clustered hierarchy, preferred levels set as cluster distances
- Throws:
CancellationException
- Upon cancellation through the given ProgressObserverIllegalArgumentException
- When less than 2 input specifiedIllegalStateException
- When distance inconsistency found during merging: the distance of a merged cluster and any other cluster must be not less than the distance of the merging clustersLicenseException
- when appropriate license is not available
-
cluster
public static IDBasedHierarchicClustering cluster(double[][] dissim, LanceWilliamsMerge merge, ProgressObserver po) throws CancellationException Invoke clustering.The current implementation requires O(n2) storage and O(n2) pairwise input comparison invocation. Over the stored dissimilarity values it requires O(n3) simple numerical comparison steps.
- Parameters:
dissim
- Distance matrix, with[<TARGET>][<QUERY>]
indicesmerge
- Cluster distance update functionpo
- Observing to track progress. Will be closed upon finishing.- Returns:
- Clustered hierarchy, preferred levels set as cluster distances
- Throws:
CancellationException
- Upon cancellation through the given ProgressObserverIllegalArgumentException
- When less than 2 input specifiedIllegalStateException
- When distance inconsistency found during merging: the distance of a merged cluster and any other cluster must be not less than the distance of the merging clustersLicenseException
- when appropriate license is not available
-