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

Is there a way to create clusters of equal size? #168

Open
mpati005 opened this issue Jun 19, 2023 · 2 comments
Open

Is there a way to create clusters of equal size? #168

mpati005 opened this issue Jun 19, 2023 · 2 comments
Labels

Comments

@mpati005
Copy link

If you take a dataset of 1000 objects and create clusters (ref: https://github.com/JustGlowing/minisom/blob/master/examples/Clustering.ipynb), you end up getting clusters of different sizes.

Further, using
# each neuron represents a cluster
winner_coordinates = np.array([sog.winner(x) for x in data]).T
# with np.ravel_multi_index we convert the bidimensional
# coordinates to a single dimensional index
cluster_index = np.ravel_multi_index(winner_coordinates, sog_shape)****

each cluster has 99, 43, 94, 74, 121 and so on number of objects.

Is there a way to create clusters that have same number of objects?

@JustGlowing
Copy link
Owner

hi @mpati005, you can try changing the number of clusters so that the samples are almost evenly distributed. Obviously there are more clever approaches but the outcomes highly depend on the data you're using.

@mpati005
Copy link
Author

Hi @JustGlowing

Thank you.

I have considered another option which is to try to change the SOM but regardless of any combination of (n*m) SOM, I am yet to see equal number of objects associated with all neurons.

Having said that, and adding to what you suggest, it might be better to create clusters based on the data points associated with the neurons first and then alter the clusters to create equal sizes.
Will update if I see something else.

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

2 participants