Skip to content

Commit 28b26e1

Browse files
committed
Fix error in Jaccard distance calculation for all zero points
1 parent 2bc3ffe commit 28b26e1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

hdbscan/dist_metrics.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,8 @@ cdef class JaccardDistance(DistanceMetric):
789789
tf2 = x2[j] != 0
790790
nnz += (tf1 or tf2)
791791
n_eq += (tf1 and tf2)
792+
if nnz == 0 and n_eq == 0:
793+
return 0.0
792794
return (nnz - n_eq) * 1.0 / nnz
793795

794796

0 commit comments

Comments
 (0)