check if data are well separated by clustering

1 view (last 30 days)
I have data labelled with either 0 or 1s. I want to know how well they can be separated by clustering. However, each time I run k means, even though the grouping is consistent, the output for the same data point is random (either 0 or 1). What I am currently doing is to reverse the result is label comparison is lower than 50%, does that make sense? Also, I am wondering how to compare it in a context where I have three categories.

Answers (1)

the cyclist
the cyclist on 20 Jul 2018
The reason that this happens is that there is randomness involved in the initial guess of centroid position. This will lead to different labeling.
I think a better way to try to get uniform labeling would be to use the final centroid position (the second output of the kmeans function), and assign labels based on that. For example, you could work systematically from smallest to largest value along the first dimension.
I don't think this will be perfect (especially if some clusters are not well separated), but it might work out.

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!