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

How Can I get the cluster number or class for an specific data point? #66

Closed
bennsandoval opened this issue Dec 9, 2016 · 2 comments
Closed
Labels

Comments

@bennsandoval
Copy link

After:
som = somoclu.Somoclu(n_columns, n_rows, data=data, maptype="toroid", initialization="pca")
som.train()
som.cluster()
som.view_umatrix(bestmatches=True)

How Can I get the cluster number or class for an specific data point like data[0]?

@peterwittek
Copy link
Owner

After calling som.cluster, the 2D array som.clusters holds the cluster information for each node. Match that with som.bmu, and you have the cluster number for each data point. Something like this:

k = 0  # The data instance you are interested in 
som.clusters[som.bmus[k, 1], som.bmus[k, 0]]

@bennsandoval
Copy link
Author

Awesome!! Thanks.

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

No branches or pull requests

3 participants