I am looking for a way to set a maximum cluster size for a clustering algorithm

Looking for a python sample of either. Constrained K-means (Balanced K-means) Capacitated Clustering (Capacitated K-means) I am looking for a way to set a maximum cluster size for a clustering algorithm.

Hi Emma,



Here are the steps you can follow to set a maximum cluster size for a clustering algorithm:

  1. Initialization: Randomly select initial centroids.
  2. Assignment with Constraints: Assign points to the nearest centroid while ensuring balanced or maximum cluster sizes.
  3. Update Centroids: Recompute the centroids based on the current assignments.
  4. Iteration: Repeat the assignment and update steps until convergence or a maximum number of iterations is reached.
Instead of providing Python sample code, we encourage you to try implementing these steps on your own. It's a great way to deepen your understanding and improve your skills. If you run into any specific issues or need further guidance, feel free to reach out.

In addition to this here are some research papers that you might find useful:
Constrained K-Means Clustering

Thanks
Rushda