May 2020
Intermediate to advanced
530 pages
17h 8m
English
The Dlib library implements the agglomerative hierarchical (bottom-up) clustering algorithm. The bottom_up_cluster() function implements this algorithm. This function takes the matrix of distances between dataset objects, the cluster indices container (as the output parameter), and the number of clusters as input parameters. Notice that it returns the container with cluster indices in the order of distances provided in the matrix.
In the following code sample, we fill the distance matrix with pairwise Euclidean distances between each pair of elements in the input dataset:
matrix<double> dists(inputs.nr(), inputs.nr()); for (long r = 0; r < dists.nr(); ++r) { for (long c = 0; c < dists.nc(); ++c) { dists(r, ...Read now
Unlock full access