How to use the hdbscan.hdbscan_.get_clusters function in hdbscan

To help you get started, we’ve selected a few hdbscan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matteodellamico / flexible-clustering / flexible_clustering / fishdbc.py View on Github external
def cluster(self, min_cluster_size=None, cluster_selection_method='eom',
                allow_single_cluster=False,
                match_reference_implementation=False):
        """Returns: (labels, probs, stabilities, condensed_tree, slt, mst)."""
        
        if min_cluster_size is None:
            min_cluster_size = self.min_samples
        self.update_mst()
        mst = np.array(self._mst_edges).astype(np.double)
        mst = np.concatenate((mst[:, 1:3], mst[:, 0].reshape(-1, 1)), axis=1)
        slt = hdbscan_.label(mst)
        condensed_tree = hdbscan_.condense_tree(slt, min_cluster_size)
        stability_dict = hdbscan_.compute_stability(condensed_tree)
        lps = hdbscan_.get_clusters(condensed_tree,
                                    stability_dict,
                                    cluster_selection_method,
                                    allow_single_cluster,
                                    match_reference_implementation)
        return lps + (condensed_tree, slt, mst)

hdbscan

Clustering based on density with variable density clusters

BSD-3-Clause
Latest version published 1 month ago

Package Health Score

91 / 100
Full package analysis