I have been instructed by my supervisor to run K-means in Matlab on my data which is comprised of sensory data observations that pertain to 7 outcomes, which I have labeled using numbers from 0 to 7.

Sensory Data Table

I have looked and experimented with the Matlab K-means examples from the documentation and have an idea of the variables it returns:

Matlab K-means

But there are many factors I am not sure about in terms of my dataset:

  1. How many clusters do I request?
  2. Does my data need normalising or segregating?
  3. What is the best way to visually show the clusters, since > 3 dimensions?
  4. Is there another clustering method that would better suit my data?
  5. How do I objectively interpret the clusters assignments?

It terms of No.3, I was thinking maybe a bar plot to demonstrate this. No.5 I appreciate is difficult because I have not done any clustering as yet, but thought I would ask just in case there is some form of validation metric that can be performed?


1 Answer 1


Before starting you need to ask yourself, or your supervisor, what are you trying to achieve by doing the cluster analysis. Cluster analysis is used to group data into sets. This could be sets

  1. This is a hard question when you know what you wish to achieve from the analysis but near impossible when you do not. However, there is a somewhat optimal number of clusters and this can most easily be found using the elbow method, or similar.
  2. By the very nature of clustering you are separating out the data, so no, I don't think you should be segregating anything out. You are advised to normalise your data if they are using different metrics, which it looks like you are. Even if they are the same metrics then it is still wise to normalised as you may be dealing with things of greatly varying magnitude.
  3. Again, this depends on what you are trying to show. If you have a variable that was a prediction from a regression or some other type of model then this could be displayed as you y-axis on a scatter graph. If you the most influential driver as the x-axis, and the clusters retained a nice grouping, this would go some way to showing that this is an important drive. You could use PCA to find only two or three axes and use these in a group coloured scatter but this would likely only show whether or not the clusters were well defined or not. This could be used to show data points on the cluster boundaries.
  4. There are many types of clustering algorithms but without knowing more it is hard to recommend any. Here is another choice in matlab.
  5. One of the ways in which you can use the clusters to interpret something about the data is to use the point closest to centroid as the "average" of that cluster. I have done this before with great success. It helped me explain to a layman the difference between each group and how the groupings were being done.
  • $\begingroup$ I'll have to discuss this in more detail with him tomorrow and share some of the points you made including PCA. I think originally, he suggested this in order to see if the number of clusters matched the number of observed outputs (x7). In the mean time, I will normalize my tabular data and keep on thinking and reading. Is there anyway you could elaborate more on your fifth point, or do you need for me to actually perform k-means and post the data? $\endgroup$ Commented Jun 20, 2016 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.