How can I reassign clusters based on similarity or any other method?

7 次查看(过去 30 天)
Description: I have data in cell format obtained from K-means clustering. The main issue is that similar clusters are being split into two separate clusters. I need to reassign the clusters based on a similarity or anyother method. Specifically, if two clusters have the same features, they should be combined into one cluster. Conversely, if a cluster has two different features, it should be split so that each subcluster has similar features. Each cell has subcells with first four columns representing important features. For example, clusters 3 and 6 have almost similar features, while cluster 2 has two different features. How can I achieve this reassignment?
  23 个评论

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2024-8-2
Sorry, I didn't delve into this lengthy discussion in detail but for what it's worth, I'm attaching a demo that lets you relabel clusters found with kmeans. As you know kmeans assigns cluster labels randomly and the label for a given cluster may change from run to run, and it might be more convenient if they were labeled according to some predefined criteria. In the demo, it does not change the number of clusters but merely gives the clusters numbers/labels that correspond to some other attribute, like distance of centroid to the origin. kmeans assumes that you know in advance the number of clusters, though there are functions that can help you determine the best choice for that number.
Another demo I'm attaching is for dbscan. https://en.wikipedia.org/wiki/DBSCAN It does not need you to tell it how many clusters there are since it finds clusters on how many points can be connected without exceeding a specified distance.
  19 个评论
Med Future
Med Future 2024-8-10
@Umar Thanks for your detail answer. But please can you make a demo code for that. I have tried that method to it does not work. if you think to Use anyother clustering method to get optimal K and applies any other Clustering. You can also use that but the problem is still there not solved
Umar
Umar 2024-8-10
Hi @ Med Future,
Can you share the code with the method applied based on my instructions. I would like to take a closer look if you don’t mind because what I described above in my comments is a very advanced and tedious process to achieve what you mentioned and not easy to implement without help. Afterwards, I will try to make a demo code as you suggested.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by