Why does KMEANS return different results when invoked on the same input?
Show older comments
When I run the following code multiple times, KMEANS returns different partitions (and hence a different vector s of within-cluster sums of point-to-centroid distances) although the data matrix a is the same:
a = [0 -1 0 2 0]
[b c s] = kmeans(a,2,'distance','cityblock')
Output 1:
b =
2
2
2
1
2
c =
2
0
s =
0
1
Output2:
b =
2
1
2
2
2
c =
-1
0
s =
0
2
Accepted Answer
More Answers (0)
Categories
Find more on Cluster Analysis and Anomaly Detection in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!