# 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. Commented Apr 15, 2016 at 17:16
• Here's a question with more detail on von Mises and so on. Commented May 12, 2016 at 17:45

## 1 Answer

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! :) Commented Apr 15, 2016 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. Commented Apr 26, 2016 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. Commented May 16, 2016 at 2:31