Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to enable HDBSCAN #208

Merged
merged 40 commits into from
May 27, 2021
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
046f703
Allowing epilogue in knn graph connection function
cjnolet Apr 20, 2021
086b08a
Fixing style
cjnolet Apr 20, 2021
37d2e0d
Adding missing argument
cjnolet Apr 23, 2021
709c040
Fixing typename
cjnolet Apr 23, 2021
b1fbc63
Updates
cjnolet Apr 23, 2021
81b630a
Fixing style
cjnolet Apr 23, 2021
6c52542
Updating to get hdbscan to compile
cjnolet Apr 23, 2021
4be3d24
Some updates
cjnolet Apr 26, 2021
1aaa7d5
changes
cjnolet Apr 29, 2021
dd6e537
agglomerative labeling to accept device arrays directly
cjnolet Apr 30, 2021
e3085cb
Cleaning up inputs to some of the single linkage prims
cjnolet Apr 30, 2021
ec1cca5
removing deprecated rmm policy usage
divyegala May 4, 2021
d32677d
Changes
cjnolet May 5, 2021
43f7cf8
removing deprecated rmm policy usage
divyegala May 4, 2021
e0ef5b3
alpha to weight alteration for precision
divyegala May 10, 2021
d809630
merge
divyegala May 10, 2021
1678c66
resolving errors
divyegala May 10, 2021
8018ea5
merge again
divyegala May 10, 2021
404e5ce
Merge branch 'fea-020-hdbscan' of github.com:cjnolet/raft into fea-02…
divyegala May 10, 2021
5eda4aa
trying alpha for all
divyegala May 11, 2021
030b3a9
double precision weight alteration
divyegala May 12, 2021
635d018
Checking in
cjnolet May 14, 2021
26dff4d
Fixing style
cjnolet May 19, 2021
55f274c
Removing unused epilogue from mst
cjnolet May 19, 2021
eb69413
Removing mst epilogue functor
cjnolet May 19, 2021
9f39d69
Merge branch 'branch-0.20' into fea-020-hdbscan
cjnolet May 19, 2021
dfebf10
Merge branch 'branch-21.06' into fea-020-hdbscan
cjnolet May 19, 2021
50d1cdc
Getting test to build
cjnolet May 20, 2021
c654156
Removing mstepiloguenoop since it's no longer being used
cjnolet May 22, 2021
136529a
another template param for weight alteration
divyegala May 24, 2021
e4b0f91
merge upstream
divyegala May 24, 2021
d7e93d9
renaming confusing variable name
divyegala May 24, 2021
e51d08b
working through merge
divyegala May 26, 2021
beea020
merging mst template PR
divyegala May 26, 2021
86cbf42
removing unnecessary comments
divyegala May 26, 2021
eb92e26
Review feedback
cjnolet May 27, 2021
e337c0d
Merge branch 'branch-21.06' into fea-020-hdbscan
cjnolet May 27, 2021
8b1e344
Update cpp/include/raft/sparse/hierarchy/detail/agglomerative.cuh
cjnolet May 27, 2021
1933520
Fixing bad merge
cjnolet May 27, 2021
1bc3e68
Merge branch 'fea-020-hdbscan' of github.com:cjnolet/raft into fea-02…
cjnolet May 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Review feedback
  • Loading branch information
cjnolet committed May 27, 2021
commit eb92e26e695662019ddaccf489219cdb7b6fee4d
66 changes: 9 additions & 57 deletions cpp/include/raft/sparse/hierarchy/detail/agglomerative.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,15 @@ class UnionFind {
};

/**
* Standard single-threaded agglomerative labeling on host. This should work
* well for smaller sizes of m. This is a C++ port of the original reference
* implementation of HDBSCAN.
* Agglomerative labeling on host. This has not been found to be a bottleneck
* in the algorithm. A parallel version of this can be done using a parallel
* variant of Kruskal's MST algorithm
* (ref http://cucis.ece.northwestern.edu/publications/pdf/HenPat12.pdf),
* which breaks apart the sorted MST results into overlapping subsets and
* independently runs Kruskal's algorithm on each subset, merging them back
* together into a single hierarchy when complete. Unfortunately,
* this is nontrivial and the speedup wouldn't bit e useful until this
cjnolet marked this conversation as resolved.
Show resolved Hide resolved
* becomes a bottleneck.
*
* @tparam value_idx
* @tparam value_t
Expand Down Expand Up @@ -137,60 +143,6 @@ void build_dendrogram_host(const handle_t &handle, const value_idx *rows,
raft::update_device(out_delta, out_delta_h.data(), n_edges, stream);
}

/**
* Parallel agglomerative labeling. This amounts to a parallel Kruskal's
* MST algorithm, which breaks apart the sorted MST results into overlapping
* subsets and independently runs Kruskal's algorithm on each subset,
* merging them back together into a single hierarchy when complete.
*
* This outputs the same format as the reference HDBSCAN, but as 4 separate
* arrays, rather than a single 2D array.
*
* Reference: http://cucis.ece.northwestern.edu/publications/pdf/HenPat12.pdf
*
* TODO: Investigate potential for the following end-to-end single-hierarchy batching:
* For each of k (independent) batches over the input:
* - Sample n elements from X
* - Compute mutual reachability graph of batch
* - Construct labels from batch
*
* The sampled datasets should have some overlap across batches. This will
* allow for the cluster hierarchies to be merged. Being able to batch
* will reduce the memory cost so that the full n^2 pairwise distances
* don't need to be materialized in memory all at once.
*
* @tparam value_idx
* @tparam value_t
* @param[in] handle the raft handle
* @param[in] rows src edges of the sorted MST
* @param[in] cols dst edges of the sorted MST
* @param[in] nnz the number of edges in the sorted MST
* @param[out] out_src parents of output
* @param[out] out_dst children of output
* @param[out] out_delta distances of output
* @param[out] out_size cluster sizes of output
* @param[in] k_folds number of folds for parallelizing label step
*/
template <typename value_idx, typename value_t>
void build_dendrogram_device(const handle_t &handle, const value_idx *rows,
const value_idx *cols, const value_t *data,
value_idx nnz, value_idx *children,
value_t *out_delta, value_idx *out_size,
value_idx k_folds) {
ASSERT(k_folds < nnz / 2, "k_folds must be < n_edges / 2");
/**
* divide (sorted) mst coo into overlapping subsets. Easiest way to do this is to
* break it into k-folds and iterate through two folds at a time.
*/

// 1. Generate ranges for the overlapping subsets

// 2. Run union-find in parallel for each pair of folds

// 3. Sort individual label hierarchies

// 4. Merge label hierarchies together
}

template <typename value_idx>
__global__ void write_levels_kernel(const value_idx *children,
Expand Down