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

Kmeans fix #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Kmeans fix #6

wants to merge 2 commits into from

Conversation

ihoromi4
Copy link

@ihoromi4 ihoromi4 commented Jun 7, 2023

It seems that KMeans has slightly incorrect code line. It results in computing as much clusters as data points.

Code to reproduce bug:

from sklearn.datasets import make_blobs
from napkin_ml import KMeans

X, y = make_blobs(n_samples=300, centers=3, random_state=1)
kmeans = KMeans()
clusters = kmeans.fit(X, 3)
print(np.unique(clusters))

Result: array([0, 1, 3])
Expected: [0, 1, 2]
Where is the 2nd cluster? Where is the 3rd cluster appeared from?

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

Successfully merging this pull request may close these issues.

1 participant