Skip to content

Commit

Permalink
fix and trait bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
azizkayumov committed Nov 27, 2024
1 parent 0209d70 commit 98641ec
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/hdbscan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,16 @@ fn find_clusters<A: FloatCore + FromPrimitive + AddAssign + Sub>(
// lambda_x = 1 / eps_x
// lambda_A = 1 / eps_C
// score(x) = 1 - lambda_x / lambda_C
fn glosh<A: FloatCore + FromPrimitive + AddAssign + Sub>(
fn glosh<A: FloatCore>(
condensed_mst: &[(usize, usize, A, usize)],
min_cluster_size: usize,
) -> Vec<A> {
let deaths = max_lambdas(condensed_mst, min_cluster_size);
let num_events = condensed_mst
.iter()
.min_by_key(|(parent, _, _, _)| *parent)
.unwrap()
.0;
.map(|(_, child, _, _)| *child)
.max()
.map_or(0, |max_child| max_child + 1);

let mut scores = vec![A::zero(); num_events];
for (parent, child, lambda, _) in condensed_mst {
Expand All @@ -445,7 +445,7 @@ fn glosh<A: FloatCore + FromPrimitive + AddAssign + Sub>(

// Return the maximum lambda value (min eps) for each cluster C such that
// the cluster or any of its child clusters has at least min_cluster_size points.
fn max_lambdas<A: FloatCore + FromPrimitive + AddAssign + Sub>(
fn max_lambdas<A: FloatCore>(
condensed_mst: &[(usize, usize, A, usize)],
min_cluster_size: usize,
) -> Vec<A> {
Expand Down

0 comments on commit 98641ec

Please sign in to comment.