how can I choose representative days from existing data clusters using kmeans built function?

Hello,
I am using the build in function in MATLAB [idx,C] = kmeans(M,k) to find reprensetative days for a whole year. the representaive days found are not from the existing defined days in my matrix.
My question is that I want the represnative days to be chosen from the real days (the centroid to be choosen from one of the data in the cluster). How can I choose the representative days from the existing data?
Please any help
Thank you very much

 Accepted Answer

Sounds like you want kmedoids instead, as that will always use an existing data point as the cluster centroid.
From the More About section in the documentation
  • The k-medoids algorithm returns medoids which are the actual data points in the data set. This allows you to use the algorithm in situations where the mean of the data does not exist within the data set. This is the main difference between k-medoids and k-means where the centroids returned by k-means may not be within the data set. Hence k-medoids is useful for clustering categorical data where a mean is impossible to define or interpret

More Answers (0)

Community Treasure Hunt

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

Start Hunting!