3
$\begingroup$

I'm currently checking some clustering evaluation indexes in R, and now I'm using Silhouette and its respective function in R, "silhouette" (in "cluster" package). To test the method, I used the following code:

data <- matrix(c(1,2, 2,1, 1,1, 2,2, 8,9, 9,8, 9,9, 8,8, 1,15, 2,15, 1,14, 2,14),12,2,byrow=T)
clust <- c(1,1,1,1, 2,2,2,2, 3,3,3,3)
diss <- as.matrix(dist(data))
sil <- mean(silhouette(clust,dmatrix=diss)[,3])

Using this data and with "clust" being the obtained configuration (from k-means), I would evaluate the silhouette of this configuration by the mean of the silhouettes for each datum. The point is that I searched for its use with k-means and found this page:

https://stat.ethz.ch/pipermail/r-help/2008-March/155939.html

And it's recommended to use the squared distance matrix instead, making sil <- mean(silhouette(clust,dmatrix=diss^2)[,3]). This use changes the result from 0.8793842 to 0.9850074.

The point for me is the evaluation of the configuration itself, and as I created the data to clearly show three groups, the higher silhouette for this configuration makes more sense to me than the lower one.

I'm not sure if I understood it right, but the use of the squared distance matrix on a k-means clustering evaluation is because of the squared distance of its cost functions. But is its use needed? I mean, the evaluation using the distance matrix would be enough to evaluate two different configurations (both resulting from k-means) and point which one is better.

So, should I use the squared distance for a k-means clustering evaluation? And as I'm evaluating the configuration, shouldn't the same distance matrix be used to evaluate many different methods?

Thanks in advance!

$\endgroup$
  • 2
    $\begingroup$ I would recommend you to read some posts here about the Silhouette criterion, one recent being this my answer. In brief: (1) One could compute a version of the index with distances to centroids rather than the averaged pairwise distances as in the original version; it's more in line with k-means. (2) You may still use original version which is quite "universal", if you like. No, I don't think there are particular reasons to prefer squared distances in this (k-means) instance unless you bother much with utmost/oulier points (while D's>1). $\endgroup$ – ttnphns Aug 21 '15 at 14:00
  • 1
    $\begingroup$ Thanks for the answer! I checked some of the matterial about Silhouette, and the use of the non-squared matrix is more general, meaning it can be used on every method (we can also compare two different methods if they use the same distance norm). Also, when comparing two k-means configurations, a better Silhouette with the squared matrix would often mean a better Silhouette with the non-squared matrix. And sorry for taking so long to answer again. $\endgroup$ – Filipe Francisco Sep 1 '15 at 13:40

Your Answer

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

Browse other questions tagged or ask your own question.