running k-means and getting different results run after run?

12 visualizaciones (últimos 30 días)
I am running k-means clustering algorithm on a data, and I don't understand why I am getting different silhouette plots each time I run this. Is there a way to stabilise this? (or set the number of iterations) so I get the same results?
  3 comentarios
cgo
cgo el 17 de Ag. de 2018
<<
These are two results of the the same data, and the same number of clusters (2). Is the data just that bad? Or I am not getting something right here?
Thanks for your insights.
>>

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 17 de Ag. de 2018
That's normal. Specify 'Replicates' to get convergence.
% Do kmeans clustering on the gray scale image.
grayLevels = double(grayImage(:)); % Convert to column vector.
[clusterIndexes, clusterCenters] = kmeans(grayLevels, numberOfClusters,...
'distance', 'sqEuclidean', ...
'Replicates', 2);
labeledImage = reshape(clusterIndexes, rows, columns);
See attached demo.
  3 comentarios
Image Analyst
Image Analyst el 27 de Mzo. de 2019
You forgot to attach 'ucd1.xlsx', or even any scatterplots. Please do so, so we can help you.
Mehmet Volkan Ozdogan
Mehmet Volkan Ozdogan el 2 de Abr. de 2019
You can find Ucd1 and ucd2.xlsx file in attachment. Thank you

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by