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

Inquiry about the centroids of the K-means method #16

Closed
hellodrx opened this issue May 27, 2022 · 3 comments
Closed

Inquiry about the centroids of the K-means method #16

hellodrx opened this issue May 27, 2022 · 3 comments

Comments

@hellodrx
Copy link

Hi, firstly thanks for your wonderful work.

I want to get the centroids of the clusters and visualize them. However, from your introduction, it seems I can only get the labels of all samples. Do you have any suggestions that I can get the results?

Thanks again for helping me out.

@hellodrx
Copy link
Author

Is this the function I can use to get the centroids

def compute_centroids(self, data, labels):

@DeMoriarty
Copy link
Owner

Hi, centroids are stored in instance variable named"centroids".

kmeans = KMeans(n_clusters=4)
kmeans.fit(x)
centroids = kmeans.centroids

@hellodrx
Copy link
Author

Hi, centroids are stored in instance variable named"centroids".

kmeans = KMeans(n_clusters=4)
kmeans.fit(x)
centroids = kmeans.centroids

Thank you very much!

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

No branches or pull requests

2 participants