# Comparing / quantifying clusters

I have 'n' observations which are classified in two classes: Class A and Class B. The observations are mis-balanced with Class A constituting around 90% of the samples and Class B around 10%. The observations are represented by 'd'-dimensional vectors. I am clustering the set using k-means clustering into 'c' clusters.

Once, I cluster these observations, I look at Class B's cluster distribution (ie. which cluster got how many class B observations). There are 'm' different ways (~500) of generating this cluster distribution by varying 'c', 'd' and one other parameter.

My goal is to identify set of parameters that yields best cluster distribution for class B. The best cluster distribution will have maximum number of Class B observations clustered into lesser (not least) number of clusters. Once, I identify "Class B" clusters, I will look at all Class A observations in those clusters and do some further analysis on them.

Problem: I am not sure how to quantify "best cluster distribution" so that I can compare these clustering results.

All suggestions are welcome !!!

Edit: End Goal: My end goal of this exercise is to identify those class A observations which display traits similar to class B. Say I form five clusters using both class A-Class B observations for a particular set of parameters. For these five clusters, I look at the assignment of Class B observations which for example looks like this: [2%, 40%, 45%, 3%, 10%]. Based on this I can clearly say that cluster 2 and 3 are "class B" clusters and all class A observations belonging to these clusters will show similar traits to class B. Now, my only problem is how do I quantify this "best clustering distribution" so that I can compare results from multiple runs.

In case, if you think there can be a better approach other than clustering to identify Class A observations that show traits similar to class B, then please do share. Thank you so much for your time and efforts !!!

• If you know there are two classes (which seems to be what your first sentence says) why are you varying the number of clusters (or doing k-means)? In fact, if you know which observations go into which class, why are you doing cluster analysis at all? Why not a supervised method? – Peter Flom Jan 17 '15 at 12:12
• Hi Peter, thanks for your response. I updated my post to give a big-picture overview for this exercise. If you think there can be a better way of doing this, then please let me know. – PS1 Jan 17 '15 at 16:57

You want the objects of one class $B$ to be concentrated in a few clusters. This happens if you choose the result that maximizes $$\sum_C |B\cap C|^2$$ where $C$ are your clusters.