I'll first discuss comparison methods, but I would also like to make a point:
In order to compare the k-means to the actual data, you should compare the distributions, since k-means is ultimately giving you an estimate of the distribution (see below). To compare the distributions, you should use the notion of "divergence" between the actual and predicted distributions. In this case, you can use the KL-divergence (aka the relative entropy) between the distributions for each class.
Since your distributions are discrete, you can use the following equation.
Given distributions $P$ and $Q$, the KL-divergence $D_{KL}(P||Q)$ is defined as follows
$$
D_{KL}(P||Q) = \sum_i P(x_i)\log_2\frac{P(x_i)}{Q(x_i)}
$$
Intuitively, this can be thought of (loosely) as a metric of the information lost when using $Q$ to try and predict $P$. In this case, $P$ is the actual distributions and $Q$ is the k-means distribution. In other words, how much information is lost when you try to use k-means to predict the actual data. The remarkable thing about the KL-divergence is that it gives you an unbiased estimate of the divergence. It can also be extended to multiple dimensions with the Renyi Divergence, but I wouldn't worry about that for your data.
Note that the base of the log is arbitrary - I used base 2 since these ideas come form information theory.
You can compare these plots by plotting the KL-divergence for each class for each plot.
Honestly, I don't think k-means is appropriate here. k-means makes a few important assumptions, which helps explain why you cannot extract the correct distribution in this case:
- k-means assumes that the variance of the distribution of each class is spherical (for example, gaussian)
- all classes have the same variance
- the prior probability of each cluster is equal (equal number of observations)
You can see clearly that the first and second statements do not hold, so k-means will fail. You could, on the other hand, try single linkage hierarchical clustering. Here is a brilliant article about what this means in practice: http://varianceexplained.org/r/kmeans-free-lunch/
Let me know if you have any questions and I can elaborate.
a
(alcohol) attribute varies a lot for wine quality compared to other attributes. But it doesn't vary as much after k-means. Now, for example, I'm not sure whether that is good or bad. $\endgroup$ – birdy Apr 5 '15 at 17:27how effectively can I classify data as correct labels
For that, you don't need these plots at all. See Wikipedia (Cluster analysis: external validation). $\endgroup$ – ttnphns Apr 5 '15 at 18:22