I am aiming to use K-means to cluster lat-lon points, but I want to apply a weight to each point's distance based on two attributes of the point.

Attribute 1 is population and attribute 2 is percent of low income households. My goal is to find optimal locations for resource distribution (center of clusters) which decreases distance from cluster center to points but is weighted closer to points of high population and low income.

I have seen this method used before, but I am not sure if this is the best way to add the weight:

weight = |attr1|^a *|attr2|^b
where a,b ∈ [0,1)

Parameters a and b are chosen depending on how much I want to weight either attribute. For example, if I wanted to favor attr1 over att2, I would choose a higher value for a.

  • $\begingroup$ It's not clear what you mean by the expression and the weighting. Where do the weight parameters $a,b$ come from? Are the attributes $attr1$ and $attr2$ have another source than the latitude/longitude position? $\endgroup$ – cherub Mar 5 at 21:17
  • $\begingroup$ @cherub, made some edits to clarify. There are many examples of using weighted k-means by a single variable (e.g. population), I am looking for a way to use weighted k-means with two variables. $\endgroup$ – jl87817 Mar 5 at 21:35
  • 1
    $\begingroup$ Usually there is some sort of distance measure -- which you would like to modify by a weight. But if you start changing the distance metric, you'd have to ensure that the change is somewhat useful. The points seem to have more properties than long/latitude. But bear in mind that points belongs to a cluster if their distance is smaller than to any other. In addition, the "intuitive" meaning of the clustering becomes severely distorted. Do you want to find an optimal value for k? Could you please explain what you mean by "two variables"? $\endgroup$ – cherub Mar 5 at 22:20
  • $\begingroup$ @cherub, thanks for your reply. Each point has a long/lat, population value, and income value associated with it and I would like the cluster centers to be closer to points with higher population and lower income. As far as K goes, I am unsure if I want to find the optimal or just based pick a figure based on total population. The 'two variables' was a reference to the two attributes associated with each point. $\endgroup$ – jl87817 Mar 6 at 0:09

The clustering with k-means is a well established method that is relatively straightforward to understand. This is mainly due to the fact that usually Euclidian distances are used. Statistically the actual mean is meant in the sense that it minimizes the variance of the distances for the chosen number $k$ of clusters.

Changing the distance metric from the Euclidian (sometimes called "naive", as in the wikipedia article) usually is no longer k-means, at least in name. There are certain requirements about the choice and calculation of weights; or rather on the metric that is chosen. This is then covered under the name of k-medoids.

A good reference for this is the evergreen "The Elements of Statistical Learning" by Hastie, Tibshirani and Friedman. The wikipedia entry is a bit shallow, but lists some other references as well.


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.