running k-means and getting different results run after run?
조회 수: 4 (최근 30일)
이전 댓글 표시
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?
채택된 답변
Image Analyst
2018년 8월 17일
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
Image Analyst
2019년 3월 27일
You forgot to attach 'ucd1.xlsx', or even any scatterplots. Please do so, so we can help you.
Mehmet Volkan Ozdogan
2019년 4월 2일
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!