Skip to content

Commit 7f325a9

Browse files
MNT use np.nonzero instead of np.where in _affinity_propagation.py (scikit-learn#30520)
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
1 parent e4fbc37 commit 7f325a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sklearn/cluster/_affinity_propagation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def _affinity_propagation(
148148
c[I] = np.arange(K) # Identify clusters
149149
# Refine the final set of exemplars and clusters and return results
150150
for k in range(K):
151-
ii = np.where(c == k)[0]
151+
ii = np.asarray(c == k).nonzero()[0]
152152
j = np.argmax(np.sum(S[ii[:, np.newaxis], ii], axis=0))
153153
I[k] = ii[j]
154154

0 commit comments

Comments
 (0)