joshlk / k-means-constrained

K-Means clustering - constrained with minimum and maximum cluster size. Documentation: https://joshlk.github.io/k-means-constrained
https://github.com/joshlk/k-means-constrained
BSD 3-Clause "New" or "Revised" License
192 stars 43 forks source link

Different constrains per cluster #15

Closed kennylajara closed 3 years ago

kennylajara commented 3 years ago

Is there a way to have a different constrains for different clusters? Like: I wan three clusters, one with a maximum of 6 points and 2 with a maximum or 4.

joshlk commented 3 years ago

Hi @kennylajara, thanks for the message. Unfortunately you can't define different constraints for each centroid. If you wanted to hack the code I would have a look at how the min-cost-flow graph is constructed and modify that function. You could then provided different constraints for each centroid. Good luck 😃