1
$\begingroup$

I'm trying to figure out a way to assign GPS coordinates to core GPS values.

For example,

I've got tons of store locations (with long & lat coordinates) and I'd like to group them to one of x core GPS groups (cities).

I know how to perform a k-means cluster analysis and let the algorithm identify the clusters itself, but in this case I know how many groups I need and where I'd like their centers to be.

Is there a way I can use the K-NN algorithm to automatically associate GPS coordinates to group centers defined by the user?

Thanks,

PS. I currently program in Stata, but if this task is easier in either Python, R, or SAS, please feel free to post how.

$\endgroup$
  • $\begingroup$ k-means in its basic form cannot decide on k (you decide on it). $\endgroup$ – ttnphns Aug 21 '15 at 22:16
3
$\begingroup$

When you predefine the "clusters" this is called classification.

Use nearest neighbor classification to map each user to the nearest city.

$\endgroup$
  • $\begingroup$ Thanks for your answer. So if establishing city GPS coordinates is how I define the clusters, is there any tutorial on how to do this and with which program would this be easiest to do? $\endgroup$ – macsmith Aug 22 '15 at 23:04
  • $\begingroup$ It's so basic, you do not need any program at all. But "nearest neighbor classification" is the search term you need. $\endgroup$ – Anony-Mousse Aug 23 '15 at 17:24

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.