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:
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!