Functions
ML::linkage Namespace Reference

Functions

void single_linkage (const raft::handle_t &handle, const float *X, int n_rows, int n_cols, size_t n_clusters, ML::distance::DistanceType metric, int *children, int *labels, bool use_knn=false, int c=15)
 Computes single-linkage hierarchical clustering on a dense input feature matrix and outputs the labels, dendrogram, and minimum spanning tree. More...
 

Function Documentation

◆ single_linkage()

void ML::linkage::single_linkage ( const raft::handle_t &  handle,
const float *  X,
int  n_rows,
int  n_cols,
size_t  n_clusters,
ML::distance::DistanceType  metric,
int *  children,
int *  labels,
bool  use_knn = false,
int  c = 15 
)

Computes single-linkage hierarchical clustering on a dense input feature matrix and outputs the labels, dendrogram, and minimum spanning tree.

Parameters
[in]handleraft handle to encapsulate expensive resources
[in]Xdense feature matrix on device, C contiguous
[in]n_rowsnumber of rows in X
[in]n_colsnumber of columns in X
[in]n_clustersthe number of clusters to fit.
[in]metricdistance metric to use. Must be supported by the dense pairwise distances API.
[out]childrenthe output dendrogram, shape=(n_rows - 1, 2), C contiguous
[out]labelsthe output labels, shape=(n_rows,)
[in]use_knnwhether to construct a knn graph instead of the full n^2 pairwise distance matrix. This can be faster for very large datasets or in cases where lower memory usage is required.
[in]ctunes the number of neighbors when use_knn is true, where n_neighbors=log(n_rows) + c.