3
$\begingroup$

I am running into problem of assessing the quality of clusters. In my case, I have plotted the data after determining data classes. For each class (1, 2, 3) there are two clouds that appear separately in two distinct areas of the plot:

http://i.stack.imgur.com/c84zx.png

I want to assess the quality of the clusters by examining closeness of points within / between clusters. Initially I thought I would just randomly assign classes to each data point (perform procedure many times) to show that points within class are much closer than it can happen by chance. However, because the plot split into 2 clouds of totally different shapes as illustrated, it makes the task much more difficult. How should I go about doing this?

$\endgroup$
  • $\begingroup$ "I would just randomly assign classes to each data point" - could you please clarify how you do that and what for? Haven't the classes already been determined by your classification routine? $\endgroup$ – Deer Hunter Mar 28 '13 at 6:17
  • $\begingroup$ Why should the clusters on the right side be worse? Because they are less spherical? Assume that your y axis is scaled differently (say 0..10 instead of 0..1 on x) - they might actually be much more spherical than the "flat" clusters on the left. $\endgroup$ – Anony-Mousse Mar 28 '13 at 9:03
  • 1
    $\begingroup$ Well, I guess that a some point in your clustering procedure you introduced a distance between points, between clusters, why not use these ? $\endgroup$ – lcrmorin Mar 28 '13 at 10:55
2
$\begingroup$

What about using silhouette graphs produced in R? Here is some background/links about the R package:

http://stat.ethz.ch/R-manual/R-devel/library/cluster/html/silhouette.html

First you have to run some clustering algorithm (k-means for example). Anything that will create a clustering object. Below is some code using the Iris data. First the clustering algorithm is run. You have to choose the number of clusters. Then the silhouette plot is run. The algorithm considers every point that it put into a cluster and the distance to the centroid of that cluster. It assigns a value of between -1 and 1.

$s_x$ =1 would mean x has distance 0 to all other points in its cluster

$s_x$ > 0 means x is closer to points in its cluster than to other clusters

$s_x$ < 0 means x is closer to some other cluster than the one it is in

It averages over the entire set and creates a silhouette for each cluster. Now you can compare the goodness of each cluster versus every other cluster. Clusters close to 1 are very tightly fit. You can try different number of clusters and compare how the silhouettes come out to see if maybe a different number of clusters is appropriate by graphing average silhouette length versus number of clusters. Below is the code and the silhouette for R's Iris data. Let me know if this helps.

Iris_KM3 = kmeans(iris[,1:4],3)
plot(silhouette(Iris_KM3$cluster, dist(iris[,1:4])))

silhouette graph example

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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