Functions
ML::HDBSCAN::detail::Utils Namespace Reference

Functions

template<typename value_idx , typename value_t , typename CUBReduceFunc >
void cub_segmented_reduce (const value_t *in, value_t *out, int n_segments, const value_idx *offsets, cudaStream_t stream, CUBReduceFunc cub_reduce_func)
 
template<typename value_idx , typename value_t >
Common::CondensedHierarchy< value_idx, value_t > make_cluster_tree (const raft::handle_t &handle, Common::CondensedHierarchy< value_idx, value_t > &condensed_tree)
 
template<typename value_idx , typename value_t >
void parent_csr (const raft::handle_t &handle, Common::CondensedHierarchy< value_idx, value_t > &condensed_tree, value_idx *sorted_parents, value_idx *indptr)
 
template<typename value_idx , typename value_t >
void normalize (value_t *data, value_idx n, size_t m, cudaStream_t stream)
 
template<typename value_idx , typename value_t >
void softmax (const raft::handle_t &handle, value_t *data, value_idx n, size_t m)
 

Function Documentation

◆ cub_segmented_reduce()

template<typename value_idx , typename value_t , typename CUBReduceFunc >
void ML::HDBSCAN::detail::Utils::cub_segmented_reduce ( const value_t *  in,
value_t *  out,
int  n_segments,
const value_idx *  offsets,
cudaStream_t  stream,
CUBReduceFunc  cub_reduce_func 
)

Invokes a cub segmented reduce function over a CSR data array using the indptr as segment offsets

Template Parameters
value_idx
value_t
CUBReduceFunc
Parameters
[in]indata array (size offsets[n_segments]+1)
[out]outoutput data array (size offsets[n_segmented]+1)
[in]n_segmentsnumber of segments in offsets array
[in]offsetsarray of segment offsets (size n_segments+1)
[in]streamcuda stream for ordering operations
[in]cub_reduce_funcsegmented reduction function

◆ make_cluster_tree()

template<typename value_idx , typename value_t >
Common::CondensedHierarchy<value_idx, value_t> ML::HDBSCAN::detail::Utils::make_cluster_tree ( const raft::handle_t &  handle,
Common::CondensedHierarchy< value_idx, value_t > &  condensed_tree 
)

Constructs a cluster tree from a CondensedHierarchy by filtering for only entries with cluster size > 1

Template Parameters
value_idx
value_t
Parameters
[in]handleraft handle for resource reuse
[in]condensed_treecondensed hierarchy (size n_leaves + n_clusters)
Returns
a new condensed hierarchy with only entries of size > 1

◆ normalize()

template<typename value_idx , typename value_t >
void ML::HDBSCAN::detail::Utils::normalize ( value_t *  data,
value_idx  n,
size_t  m,
cudaStream_t  stream 
)

◆ parent_csr()

template<typename value_idx , typename value_t >
void ML::HDBSCAN::detail::Utils::parent_csr ( const raft::handle_t &  handle,
Common::CondensedHierarchy< value_idx, value_t > &  condensed_tree,
value_idx *  sorted_parents,
value_idx *  indptr 
)

Computes a CSR index of sorted parents of condensed tree.

Template Parameters
value_idx
value_t
Parameters
[in]handleraft handle for resource reuse
[in,out]condensed_treecluster tree (condensed hierarchy with all nodes of size > 1)
[in]sorted_parentsparents array sorted
[out]indptrCSR indptr of parents array after sort

◆ softmax()

template<typename value_idx , typename value_t >
void ML::HDBSCAN::detail::Utils::softmax ( const raft::handle_t &  handle,
value_t *  data,
value_idx  n,
size_t  m 
)

Computes softmax (unnormalized). The input is modified in-place. For numerical stability, the maximum value of a row is subtracted from the exponent.

Template Parameters
value_idx
value_t
Parameters
[in]handleraft handle for resource reuse
[in]datainput matrix (size m * n)
[in]nnumber of columns
[out]mnumber of rows