Skip to content

Commit 3f5b573

Browse files
committed
silence divide by zero
1 parent eeb2622 commit 3f5b573

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fast_hdbscan/branches.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ def compute_centrality(data, probabilities, *args):
66
points = args[-1]
77
cluster_data = data[points, :]
88
centroid = np.average(cluster_data, weights=probabilities[points], axis=0)
9-
return 1 / np.linalg.norm(cluster_data - centroid[None, :], axis=1)
9+
with np.errstate(divide="ignore"):
10+
return 1 / np.linalg.norm(cluster_data - centroid[None, :], axis=1)
1011

1112

1213
def apply_branch_threshold(

0 commit comments

Comments
 (0)