K-means clustering output matrix C (represent centroid locations)

16 views (last 30 days)
Hello,
I am using kmeans clustering function to cluster a principal components matrix (pcs) with dimension 13149x10, where each column of the pcs matrix represent a principal component with decreasing order of explained variance. The number of clusters that I want to use is k = 8. I want to plot the location of the 8 centroids resulting from the kmeans algorithm, but the output matrix C (which gives the location of the centroids) has a size of 8x10 (k-by-p). Why there are 10 columns/ooordinates in C to define the position of each centroid? It shouldn't it be 2 columns?
The command that I am using is this:
[idx,C,sumd,D] = kmeans(pcs(:,1:10),k,'Replicates',10,'Start','cluster');
Appreciate your help.
Thank you!

Accepted Answer

the cyclist
the cyclist on 22 Sep 2022
You have 8 centroids, each of which is a point in a 10-dimensional space. Each row gives the 10 coordinates needed to locate that centroid in 10 dimensions.
I'm not sure why you expected 2 columns.
  1 Comment
Rui Silva
Rui Silva on 22 Sep 2022
Thanks for your reply,
I was actually making some confusion with the examples in the documentation which are in two-dimensional space. Now it makes sense.
Kind regards,
Rui Silva

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!