# Weighting k-means with two attributes

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.

• 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? – cherub Mar 5 at 21:17
• @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. – jl87817 Mar 5 at 21:35
• 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"? – cherub Mar 5 at 22:20
• @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. – 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.