Class PDistClusteringAlgorithm

java.lang.Object
ffx.numerics.clustering.PDistClusteringAlgorithm
All Implemented Interfaces:
ClusteringAlgorithm

public class PDistClusteringAlgorithm extends Object implements ClusteringAlgorithm
Clustering algorithm that consumes a condensed (pdist-style) upper-triangular distance array to produce hierarchical agglomerative clusters. Supports flat clustering by threshold; weighted inputs delegate to unweighted behavior.
Since:
1.0
Author:
Lars Behnke, 2013, Michael J. Schnieders
  • Constructor Details

    • PDistClusteringAlgorithm

      public PDistClusteringAlgorithm()
  • Method Details

    • performClustering

      public Cluster performClustering(double[][] distances, String[] clusterNames, LinkageStrategy linkageStrategy)
      Performs hierarchical agglomerative clustering using a condensed pdist-like matrix.
      Specified by:
      performClustering in interface ClusteringAlgorithm
      Parameters:
      distances - a 1 x M array holding the upper-triangular distances in row-major pdist order
      clusterNames - names corresponding to the N items (M = N*(N-1)/2)
      linkageStrategy - linkage criterion used during agglomeration
      Returns:
      root Cluster of the resulting hierarchy
    • performFlatClustering

      public List<Cluster> performFlatClustering(double[][] distances, String[] clusterNames, LinkageStrategy linkageStrategy, Double threshold)
      Produces a flat clustering from a condensed distance matrix by agglomerating until the threshold is exceeded.
      Specified by:
      performFlatClustering in interface ClusteringAlgorithm
      Parameters:
      distances - a 1 x M condensed distance array (pdist order)
      clusterNames - names of the N items
      linkageStrategy - linkage criterion used during agglomeration
      threshold - maximum allowed linkage distance for merging
      Returns:
      list of clusters at the chosen cut
    • performWeightedClustering

      public Cluster performWeightedClustering(double[][] distances, String[] clusterNames, double[] weights, LinkageStrategy linkageStrategy)
      Weighted variant for condensed inputs; currently delegates to unweighted clustering as weights are not applied with condensed input in this implementation.
      Specified by:
      performWeightedClustering in interface ClusteringAlgorithm
      Parameters:
      distances - a 1 x M condensed distance array (pdist order)
      clusterNames - names of the N items
      weights - weights for the N items (unused)
      linkageStrategy - linkage criterion used during agglomeration
      Returns:
      root Cluster of the resulting hierarchy