I have created a dataset with my geolocations from the last three months. The data set contains longitude, latitude, and timestamp, with a frequency of every 5 minutes. Based on this data, I want to predict my (geo)location for up to two weeks into the future. I would like to end up with several predictions with a degree of certainty.

I see two options:

  1. Translate it into a classification problem with discrete target locations such as home, workplace, gym. Furthermore, I would have to create features that describe when I was at some place, basically translating the temporal dimension into features. These features could include hour of day, day of the week, etc. I'm not sure if this method is able to capture a temporal trend, though.
  2. Use forecasting models to forecast/predict the actual latitude and longitude coordinates. Then translate the predicted latitude/longitude into a location such as 'home' or 'work'. The biggest problem I see here is that this will give me only one location, instead of a list of locations with respective certainties.

I am looking for more/better suggestions how I might do this. Thanks in advance!


3 Answers 3


I see multiple possibilities, here:

In General

Some general remarks first:

  • When designing you model, you should take reoccurring patterns into account: There will probably be a 24h pattern (for example: being at work has every 24h a similar probability, while 12h after being at work, the probability to be at work will be quite low). There might also be a 7 day pattern (e.g. every Wednesday evening one might go for sports). This can be done by extracting different features from the timestamp (the hour, the weekday) or choosing a suitable kernel / distance function.
  • There are variants: you can either predict all locations you might visit in the next 2 weeks (independent of when) or you might predict for each time (e.g. each day / each hour or even every 5 minutes) where you might be. With many approaches, both variants might be possible.

Finite set of locations

This is basically your option 1. Just some more ideas:

  • You might consider to to apply some clustering on your recorded data to find reoccurring locations and use these as target locations.
  • You do not need to transform the temporal dimension into features. There are techniques that can handle time series as input (e.g. recurrent neural networks like LSTMs or transformer networks)


You could put a raster over you area of interest (e.g. your city). It depends on you to choose an appropriate cell size. Now you can predict for each cell the probability that you will visit it. This will create kind of a heat-map.

Choosing the raster-approach allows you to handle your data as a series of images, which allows for techniques such as CNNs.

Gaussian Processes / Kriging

Gaussian Processes (a.k.a Kriging in the field of geostatistics) allow to learn a probability distribution over the spatiotemporal space (which seem to be waht you are looking for). Unfortunately, they come with some disadvantages:

  • Gaussian Processes are better with interpolation than with extrapolation. You might get some strong uncertainties.
  • Gaussian Processes are computationally expensive. You probably have too much data and might have to subsample or compress it.
  • Originally, they are used for unbound regression with Gaussian distributions. You are looking more for classifications (will you be there). This can also be done, but requires some extra steps.

Note: These are just some approaches and directions to look into.

  • $\begingroup$ Hi Broele, thanks for your reply! I think specifically the first option will be suitable. As for the rasterization, is that irrespective of the prediction model? $\endgroup$
    – sander
    Commented Mar 13, 2023 at 20:24
  • 1
    $\begingroup$ Hi Sander, the rasterization would work with most prediction models, although some are more suitable than others. Since it creates an image-like representation, I would start with CNNs. Note, that there are multiple variants and details you need to figure out. $\endgroup$
    – Broele
    Commented Mar 14, 2023 at 14:31
  • $\begingroup$ All right, thank you. I will think about it and conduct some research into those techniques. $\endgroup$
    – sander
    Commented Mar 15, 2023 at 9:47

You are correct there are many ways to model that data, in particular predicting future latitude and longitude coordinates. It sounds like you want to model the geospatial data probabilistically.

One option to probabilistically model geospatial is a variation on the Kalman filter. A typical Kalman filter estimates unknowns from a series of measurements over time. In your case, the output estimate would be about the future location state at different time points.

  • $\begingroup$ Hi Brian, thanks for your answer. I'm not too familiar with the Kalman filter, but I know they're used to predict trajectories of moving objects. Correct me if I'm wrong, but to my understanding, such trajectories are quite predictable as they follow well-defined scientific laws. My data set does not seem comparable in that sense since it contains much more variability. What do you think? $\endgroup$
    – sander
    Commented Mar 13, 2023 at 20:05

On first impressions, I'm inclined to segregate data for locations which have significance (need not just be home, gym, office), from insignificant ones (travel, traffic) using continuous time spent within some radius buffer. Since you also have a lot of data, you could use neural network of your choice, from which you could get top 3 prediction.

PS. Make sure that you don't encode locations as one hot vectors, location context would be lost if all vectors are equidistant from each other. I'd also consider clustering time chunks into labels, not as a continuous variable. Curious to know if this would follow Zipf's law as well.

  • $\begingroup$ Hi, thanks for your reply. A few questions. 1) What do you mean by clustering time chunks into labels instead of continuous variables? 2) Do you have any suggestions on which NN to use and how I should format my input data? $\endgroup$
    – sander
    Commented Mar 15, 2023 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.