Class LanceWilliamsAlgorithm

java.lang.Object
com.chemaxon.clustering.wards.LanceWilliamsAlgorithm

@Beta @PublicApi public final class LanceWilliamsAlgorithm extends Object
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.

See Also:
  • Method Details

    • calculateDissimilarityMatrix

      public static double[][] calculateDissimilarityMatrix(DissimilarityInput input, ProgressObserver po)
      Distance matrix calculation.
      Parameters:
      input - Input dissimilarity space
      po - Progress observer
      Returns:
      Distance matrix, with [<TARGET>][<QUERY>] indices
    • cluster

      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 space
      merge - Cluster distance update function
      ppo - Observing progress observer. Two PhasedProgressObserver.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 ProgressObserver
      IllegalArgumentException - When less than 2 input specified
      IllegalStateException - 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 clusters
      LicenseException - 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>] indices
      merge - Cluster distance update function
      po - 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 ProgressObserver
      IllegalArgumentException - When less than 2 input specified
      IllegalStateException - 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 clusters
      LicenseException - when appropriate license is not available