Package ffx.numerics.clustering
Class PDistClusteringAlgorithm
java.lang.Object
ffx.numerics.clustering.PDistClusteringAlgorithm
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionperformClustering
(double[][] distances, String[] clusterNames, LinkageStrategy linkageStrategy) Performs hierarchical agglomerative clustering using a condensed pdist-like matrix.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.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.
-
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 interfaceClusteringAlgorithm
- Parameters:
distances
- a 1 x M array holding the upper-triangular distances in row-major pdist orderclusterNames
- 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 interfaceClusteringAlgorithm
- Parameters:
distances
- a 1 x M condensed distance array (pdist order)clusterNames
- names of the N itemslinkageStrategy
- linkage criterion used during agglomerationthreshold
- 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 interfaceClusteringAlgorithm
- Parameters:
distances
- a 1 x M condensed distance array (pdist order)clusterNames
- names of the N itemsweights
- weights for the N items (unused)linkageStrategy
- linkage criterion used during agglomeration- Returns:
- root Cluster of the resulting hierarchy
-