Clear Filters
Clear Filters

Is there any provision to specify the cluster size for each cluster in Kmeans clustering algorithm in MATLAB?

10 views (last 30 days)
Iam working on cell grouping for indoor small cell radio(dots).
For example we have 80 dots and we nned to group these dots into 10 cells(10 clusters each cell with 8 dots). i have used inbuilt kmeans() in matlab by passing dots xy positions and k(here k = 10) as:
dotsXY = [real(nodes.xy)',imag(nodes.xy)'];
dotGroup = kmeans(dotsXY,10)
Here iam successfully able to cluster the dots but each cluster is of different size. Since Iam new to clustering algorithm, it would be helpful if I get some suggestion/method to proceed futher in how to keep cluster size same for all cluster in kmeans algorithm.
Thanks in advance.

Answers (2)

Cris LaPierre
Cris LaPierre on 2 Apr 2024

Jon on 2 Apr 2024
Edited: Jon on 2 Apr 2024
The goal of k-Means clustering is to minimize the distance of the points in each cluster to the cluster centroid. As you note you can specifiy the number of clusters, but then the number of points in each cluster depends upon the location of the points you are clustering.
Imagine the extreme case, in 2d where you have say 100 points, 80 of them are identical and located at a point (1,1) and another 20 points are all identical and located at (2,2). If you choose two clusters, you will of course have 80 in one cluster and 20 in the other.
So in the above scenario, by what criteria would you want to put 50 of the points into a cluster at (1,1) and 50 at (2,2), Or, more generally, for this scenario where would you suggest putting the cluster centers if you wanted 50 points in each?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!