# The right way to use Machine Learning to predict latitude and longitude

There are some simple ML techniques that can be used to easily predict latitude/longitude co-ordinates, such as predicting the latitude and longitude separately using two different models. However, I get the sense that this is a simple hack that doesn't give the best results. To quote another paper:

Most regression methods assume either that either only one real number is to be predicted, or if multiple real numbers are to be predicted that they are independent. The problem of predicting a point on the surface of a sphere is more complicated as the latitudes and longitudes involved are not independent.

Unfortunately, the authors of the linked paper just side-step the issue by using kNN. I'd like to use supervised learning with some non-geographical inputs (strings, numbers, etc...) to predict a latitude/longitude co-ordinate, and I'd like to approach it using "best practices" rather than a simple hack. How should I go about it? Any links to any papers or blog posts would be much appreciated. Thanks!

• von Mises distribution is a good fit for modeling data on circle and on sphere by extension. Apr 15 '16 at 17:16
• Here's a question with more detail on von Mises and so on. May 12 '16 at 17:45

The problem isn't just potential interdependence of latitudes and longitudes; it's that the scales wrap around. On a circle 359 degrees and 1 degree are quite close. A general term for this type of problem is directional statistics.

One way to start with analysis of spatial data would be to go over the CRAN Task View on that topic. That page details the many R packages available for handling spatial data, analyzing point patterns, doing spatial regression, etc. Documentation for R packages that seem related to your specific interests will typically include helpful references to related literature.

• As if things weren't complicated enough! Now I have to deal with spatial autocorrelation AND the scales wrapping around! :) Apr 15 '16 at 19:00
• A little additional info that might be helpful: according to another question, there is a book about spatial data analysis in R. This book might be helpful for those hoping to learn about this kind of thing. Apr 26 '16 at 14:52
• Both answers have some useful information, but I've ultimately decided to mark this answer as the correct one. I think that when trying to do machine learning/regression with a lat/lon as the output (rather than the input), this answer is more relevant. May 16 '16 at 2:31

One obvious choice is kriging/Gaussian process methods. Step 1 is to measure the geodesic distances between the points of interest, step 2 is to use that distance as the metric for some kernel (RBF, Matern, whatever), and step 3 is to make predictions. Because you're using geodesic distances, you're "baking in" the fact that the data lives on a sphere. Because you're explicitly modeling the correltion between the points in space, you won't have the problems that arise from inappropriately assuming independence among units.

• I found a paper that also mentions the "use geodesic distances" strategy that you've suggested. It's available at this address: (sciencedirect.com/science/article/pii/S1574954112001045). Do you think that this paper has the right idea? Apr 18 '16 at 14:43
• The paper is pay-walled, so it's hard to say without reading the whole thing. The abstract provides some evidence that this method has desirable attributes for spatial problems.
– Sycorax
Apr 19 '16 at 18:38
• Sorry about the pay-wall. There's actually a PDF version freely available that I found through Google Scholar: di.uniba.it/~ceci/Papers/Pubblicazioni/International%20Journals/…. I'd appreciate hearing any thoughts that you may have. Apr 21 '16 at 20:13