Public Member Functions | List of all members
ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t > Class Template Reference

#include <hdbscan.hpp>

Collaboration diagram for ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >:
Collaboration graph

Public Member Functions

 CondensedHierarchy (const raft::handle_t &handle_, size_t n_leaves_)
 
 CondensedHierarchy (const raft::handle_t &handle_, size_t n_leaves_, int n_edges_, value_idx *parents_, value_idx *children_, value_t *lambdas_, value_idx *sizes_)
 
 CondensedHierarchy (const raft::handle_t &handle_, size_t n_leaves_, int n_edges_, int n_clusters_, rmm::device_uvector< value_idx > &&parents_, rmm::device_uvector< value_idx > &&children_, rmm::device_uvector< value_t > &&lambdas_, rmm::device_uvector< value_idx > &&sizes_)
 
void condense (value_idx *full_parents, value_idx *full_children, value_t *full_lambdas, value_idx *full_sizes, value_idx size=-1)
 
value_idx get_cluster_tree_edges ()
 
value_idx * get_parents ()
 
value_idx * get_children ()
 
value_t * get_lambdas ()
 
value_idx * get_sizes ()
 
value_idx get_n_edges ()
 
int get_n_clusters ()
 
value_idx get_n_leaves () const
 

Detailed Description

template<typename value_idx, typename value_t>
class ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >

The Condensed hierarchicy is represented by an edge list with parents as the source vertices, children as the destination, with attributes for the cluster size and lambda value.

Template Parameters
value_idx
value_t

Constructor & Destructor Documentation

◆ CondensedHierarchy() [1/3]

template<typename value_idx , typename value_t >
ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::CondensedHierarchy ( const raft::handle_t &  handle_,
size_t  n_leaves_ 
)

Constructs an empty condensed hierarchy object which requires condense() to be called in order to populate the state.

Parameters
handle_
n_leaves_

◆ CondensedHierarchy() [2/3]

template<typename value_idx , typename value_t >
ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::CondensedHierarchy ( const raft::handle_t &  handle_,
size_t  n_leaves_,
int  n_edges_,
value_idx *  parents_,
value_idx *  children_,
value_t *  lambdas_,
value_idx *  sizes_ 
)

Constructs a condensed hierarchy object with existing arrays which already contain a condensed hierarchy.

Parameters
handle_
n_leaves_
n_edges_
parents_
children_
lambdas_
sizes_

◆ CondensedHierarchy() [3/3]

template<typename value_idx , typename value_t >
ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::CondensedHierarchy ( const raft::handle_t &  handle_,
size_t  n_leaves_,
int  n_edges_,
int  n_clusters_,
rmm::device_uvector< value_idx > &&  parents_,
rmm::device_uvector< value_idx > &&  children_,
rmm::device_uvector< value_t > &&  lambdas_,
rmm::device_uvector< value_idx > &&  sizes_ 
)

Constructs a condensed hierarchy object by moving rmm::device_uvector. Used to construct cluster trees

Parameters
handle_
n_leaves_
n_edges_
n_clusters_
parents_
children_
lambdas_
sizes_

Member Function Documentation

◆ condense()

template<typename value_idx , typename value_t >
void ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::condense ( value_idx *  full_parents,
value_idx *  full_children,
value_t *  full_lambdas,
value_idx *  full_sizes,
value_idx  size = -1 
)

To maintain a high level of parallelism, the output from Condense::build_condensed_hierarchy() is sparse (the cluster nodes inside any collapsed subtrees will be 0).

This function converts the sparse form to a dense form and renumbers the cluster nodes into a topological sort order. The renumbering reverses the values in the parent array since root has the largest value in the single-linkage tree. Then, it makes the combined parent and children arrays monotonic. Finally all of the arrays of the dendrogram are sorted by parent->children->sizes (e.g. topological). The root node will always have an id of 0 and the largest cluster size.

Ths single-linkage tree dendrogram is a binary tree and parents/children can be found with simple indexing arithmetic but the condensed tree no longer has this property and so the tree now relies on either special indexing or the topological ordering for efficient traversal.

◆ get_children()

template<typename value_idx , typename value_t >
value_idx* ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::get_children ( )
inline

◆ get_cluster_tree_edges()

template<typename value_idx , typename value_t >
value_idx ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::get_cluster_tree_edges ( )

◆ get_lambdas()

template<typename value_idx , typename value_t >
value_t* ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::get_lambdas ( )
inline

◆ get_n_clusters()

template<typename value_idx , typename value_t >
int ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::get_n_clusters ( )
inline

◆ get_n_edges()

template<typename value_idx , typename value_t >
value_idx ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::get_n_edges ( )
inline

◆ get_n_leaves()

template<typename value_idx , typename value_t >
value_idx ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::get_n_leaves ( ) const
inline

◆ get_parents()

template<typename value_idx , typename value_t >
value_idx* ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::get_parents ( )
inline

◆ get_sizes()

template<typename value_idx , typename value_t >
value_idx* ML::HDBSCAN::Common::CondensedHierarchy< value_idx, value_t >::get_sizes ( )
inline

The documentation for this class was generated from the following file: