Azzera filtri
Azzera filtri

Clustering

1 visualizzazione (ultimi 30 giorni)
shyam Kumar
shyam Kumar il 3 Apr 2011
Risposto: VM Sreeram il 27 Giu 2023
Hi,
I need to cluster the coordinates of 400 cells into 20 clusters with each cluster HAVING THE SAME NUMBER OF ELEMENTS. Is it possible to do this by kmeans. Can K means ensure that each cluster has the same number of elements ?
thanks in advance,
Shyam

Risposte (1)

VM Sreeram
VM Sreeram il 27 Giu 2023
k-means clustering, is an algorithm that assigns n observations to exactly one of k clusters defined by centroids, where k is chosen before the algorithm starts [1].
It means that even we run k-means with k = 400/20 = 20, it does not guarentee that each cluster has equal number of elements.
If you want to ensure that each cluster has equal number of elements, you may run a post-processing step, wherein you reassign datapoints between clusters to balance the cluster sizes. One approach is to iteratively reassign the data points from the largest clusters to the smallest clusters until all clusters have the desired number of elements.

Community Treasure Hunt

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

Start Hunting!

Translated by