I am trying to get to grips with Clustering and Visualisation.
I have a set of data (a matrix) that I want to cluster (using R) and then visualise (HTML5 Canvas).
So, I can use MDS to get the coordinates of a matrix, for example:
cells <- c(1, 1, 2, 1, 4, 3, 5, 4) rnames <- c("A", "B", "C", "D") cnames <- c("X", "Y") x <- matrix(cells, nrow=4, ncol=2, byrow=TRUE, dimnames=list(rnames, cnames)) d <-dist(x) m <- cmdscale(d,eig=TRUE, k=3) m <- cmdscale(d,eig=TRUE, k=2) print(m)
But, should I first cluster this data (using something like k-means) or should I cluster the output of MDS? Or can I just cluster (and get the coordinates using some other method) and ignore MDS?
What is the relationship between MDS and K-means, if any?
I am unsure what is the best way to approach?