2
$\begingroup$

I have a so so sized data set - 30 000 observations. I would like to run K-means on them but to restrict the center(mean) of the data. This is, I would like to push the clusters away from this mean. As I have noticed that independantly of the # of clusters, one ends up landing right on top of the mean of all the variables, like a smaller version of the whole data set. Is there a way to restrict K-means to not behave this way? By the way I have two different ways to initialize cluster centers, random starting points and means of random samples of the data. I run each 500 times and the solution seems stable enough but maybe k-means++ would have a different outcome? I wouldnt think so... thank you in advanced reader.

$\endgroup$
  • 3
    $\begingroup$ I may be a bit off-topic, but why can you not accept a cluster that happens to land at the overall mean? Is it known or obvious that there is no cluster there and it's somehow an artifact of the algorithm? $\endgroup$ – Wayne Jul 6 '12 at 19:26
  • $\begingroup$ I can totally accept it as it clearly reflects a pattern in the data but I am doint this for someone else and "he" wants to see what happens if we try this. Is it is even possible. Greetings. $\endgroup$ – JEquihua Jul 6 '12 at 20:09
  • $\begingroup$ The next question would be, what program are you using to do K-means? R, SAS, Stata, SPSS? Each might offer different initialization options that might help you. (In R's default kmeans, for example, you can manually specify the initial cluster centers. I doubt that you can keep a center from migrating where you don't want it, but there may be other R implementations.) $\endgroup$ – Wayne Jul 6 '12 at 20:40
  • $\begingroup$ Yes, I'm using R and I have used the initializations I described. But I would still like to "force" it, I don't know... force it out of the "center" or, restrict it to not be able to converge there; I'm not entirely sure it makes sense. $\endgroup$ – JEquihua Jul 7 '12 at 0:26
2
$\begingroup$

I can't see any way to do what you want with the basic k-means routines in R.

The best trick I can think of is to use one of the c-means routines and then at the end take all points that have their largest membership in your Forbidden Center Cluster and reassign each one to the cluster with its second-largest membership.

You could also look at flexclust and its kcca, or really dig deep into the mclust or fps packages and roll your own.

Or you might abandon k-means clustering and use something else. R has a whole boatload of other methods, but I'll point out that flexclust's cclust has a Neural Gas clustering option. I have always liked Neural Gas, if only because it's a cool name. No guarantee that a different clustering algorithm will work better then k-means, but it's worth a try.

$\endgroup$
  • $\begingroup$ What is c-means? I'll look into it, thank you! $\endgroup$ – JEquihua Jul 7 '12 at 19:10
  • $\begingroup$ @JEquihua: c-means is continuous rather than hard, so each point has a value [0, 1] for each cluster. So if a particular point has its highest value for your center cluster, you can look for its second-highest value and put it in that cluster. The problem is that near the center of your forbidden cluster all of the other cluster values may be very small and nearly the same. $\endgroup$ – Wayne Jul 7 '12 at 23:11

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.