freediscovery.cluster.utils._binary_linkage2clusters

freediscovery.cluster.utils._binary_linkage2clusters(linkage, n_samples)[source]

Given a list of elements of size n_sample and a linkage matrix linking some of those samples, compute the cluster_id of each element

Parameters:
  • linkage (array (n_pairs, 2)) – arrays indicating binary links between elements
  • n_samples (int) – total number of elements
Returns:

labels

Return type:

array (n_samples)