Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with affinity propagation and dtype np.float32 #23897

Open
glemaitre opened this issue Jul 14, 2022 · 1 comment
Open

Issue with affinity propagation and dtype np.float32 #23897

glemaitre opened this issue Jul 14, 2022 · 1 comment

Comments

@glemaitre
Copy link
Member

While working on #23838, it seems that the issue observed in #10832 was not solved since it breaks for different random seeds.

Therefore, we should revisit the original issue.

@github-actions github-actions bot added the Needs Triage Issue requires triage label Jul 14, 2022
@thomasjpfan thomasjpfan added Bug module:cluster and removed Needs Triage Issue requires triage labels Jul 15, 2022
@jeremiedbb
Copy link
Member

The snippet reported in #10832

import sklearn.cluster
import numpy as np

k = np.array([[1,0,0,0],
              [0,1,1,0],
              [0,1,1,0],
              [0,0,0,1]], dtype='float32')

afp = sklearn.cluster.AffinityPropagation(preference=1, affinity='precomputed').fit(k)
print(afp.labels_)

expects 3 clusters, with labels [0,1,1,2]. It actually has nothing to do with float32 or float64: it breaks for some random seeds whether k is float64 or float32.

I'm not familiar with this estimator so I don't know if this clustering should be expected regardless of the noise added during fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants