# how to determine the optimum number of cluster use K-Mean Clustering

50 visualizzazioni (ultimi 30 giorni)
lina il 5 Apr 2012
Risposto: kira il 2 Mag 2019
Hi everyone,
Is there anyone knows how to determine the optimum number of cluster in K-Means Clustering ?? If there's any matlab code for it I very appreciate.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (2)

Walter Roberson il 5 Apr 2012
Basically, there isn't a way, not really.
There are papers on the topic that show algorithms that have been developed. The algorithms mostly involve running K-Means with a fixed number of clusters, running it again with 1 more cluster, then again with 1 more yet, and so on, and trying to figure out the "best" point in the downturn curve of classification effectiveness.
Since, after all, you can get better classification by running with as many clusters as you have points, the algorithms try to figure out a "reasonable" stopping place where the error rate "isn't too bad" and increasing the number of clusters "don't help much". There is of course a lot of subjectivity about that, and it depends upon having a good measure for "error rate" which you often don't have (and tends to vary with context when you do have it.)
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

kira il 2 Mag 2019
old question, but I just found a way myself looking at matlab documentation:
klist=2:n;%the number of clusters you want to try
myfunc = @(X,K)(kmeans(X, K));
eva = evalclusters(net.IW{1},myfunc,'CalinskiHarabasz','klist',klist)
classes=kmeans(net.IW{1},eva.OptimalK);
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Cluster Analysis in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by