Skip to content

Commit

Permalink
Merge pull request #558 from tadorfer/fixValidityIndex
Browse files Browse the repository at this point in the history
Fixed: validity index no longer returning nan
  • Loading branch information
lmcinnes committed Aug 23, 2022
2 parents 523cd86 + f2e2af9 commit 379d523
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hdbscan/validity.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ def all_points_core_distance(distance_matrix, d=2.0):
distance_matrix != 0]) ** d
result = distance_matrix.sum(axis=1)
result /= distance_matrix.shape[0] - 1
result **= (-1.0 / d)

if result.sum() == 0:
result = np.zeros(len(distance_matrix))
else:
result **= (-1.0 / d)

return result

Expand Down

0 comments on commit 379d523

Please sign in to comment.