Kmeans Clustering Using the Distance Matrix
Show older comments
In Matlab predefine function of K-means, we can do the clustering by giving the location of data points and number of clusters. Can we use the same K-means function to do clustering just on the basis of distance matrix and number of clusters?
Answers (2)
Image Analyst
on 5 Jan 2018
0 votes
Yes. The feature(s) upon which you do cluster analysis can be distance or whatever you want.
4 Comments
MA-Winlab
on 21 Mar 2019
@Image Analyst, the distance matrix will have 0s on the diagonal. Is that OK when applying Kmeans?
Image Analyst
on 21 Mar 2019
Yes, but why would that be the case? Why would that happen? It normally wouldn't and would be very unusual to happen at random. My guess is you're not using a correct feature matrix.
MA-Winlab
on 24 Mar 2019
I have a set of pulses I am extracting from accelrometer and calculating the distance between each two pulses (pairwise). This way I am contructing a distance matrix and since I am doing this pairwise, then the diagonal will be 0s.
Image Analyst
on 24 Mar 2019
What does that have to do with kmeans?
Asghar Moeini
on 29 Apr 2018
0 votes
No you cannot, as you need data for calculating centroids in each iterations, but you can use kmedioids clustering method which use medians instead of centriods. This algorithm is doownloadable in the following link: https://au.mathworks.com/matlabcentral/fileexchange/28860-kmedioids?focused=5165469&tab=function
Categories
Find more on k-Means and k-Medoids Clustering 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!