Your travelling habits often follow certain patterns. The most common is a daily commute between home and workplace, but in many other situations as well there is a basis for assuming what your likely next destination will be. The prediction is of course done based on your past travelling records. The basic idea is that your GPS navigation system is able figure out where you might be going based on your current location, weekday, time of day and a couple of other parameters.
The aforementioned typical example which first pops to mind is your daily commute. This is the easiest pattern to recognize. But often it is interrupted with things like workouts on Tuesdays or beer with colleagues on Fridays. Maybe you going to these locations depends on what you did earlier today – did you do your workout in the morning? Did you leave your child at kindergarten before work? For another example, imagine it's evening and you went to visit your friends for the first time. When you sit in your car afterwards, what is your likely next destination? Although you never took this particular route before (as far as your GPS navigation knows), it makes most sense to assume you are going to a place you go to every night – home. All of these examples are complex patterns which we wanted our AI to be able to recognize.
There are a handful of possible uses for such system. For starters, if you wish to use turn-by-turn navigation you don't have to type in your destination, so that's convenient. But the field where it has the widest possible usage is Advanced driver-assistance systems (ADAS). These are electronic systems that help the vehicle driver while driving or during parking. The examples of ADAS are anti-lock braking system (ABS), adaptive cruise control, electronic stability control, parking sensors, lane departure warning system etc. Using the information about your likely next destination, the GPS navigation system can predict your most probable path. Using this, the infotainment system in your car can alert you about congestions up ahead without you actively turning turn-by-turn navigation on. Or it can tell you that the bad weather is expected on your route. Furthermore, imagine a scenario where cars are connected to the internet and certain car sensor readings are shared online – you could be warned about excessive ABS usage on part of your route, which may be the result of icy roads or oil spillage.
During the course of creating such AI model, we constructed a list of conditions it should comply with. Needless to say, not all of the conditions were obvious from the start.
First we had to precisely define what should be regarded as a trip's destination. If you stop along the way to leave your child at a soccer practice or to fill your car, does that count as an interim stop or the end of the trip? What about if you get stuck in traffic for a certain period? After careful consideration, we decided to regard the trip as being finished if you turn the engine off for more than 3 minutes.
Next, chances are good that for most places you visit you don't have a dedicated parking spot, so the exact parking location varies. In order to learn what the likely next destination is, the system must be able to figure out these parking locations actually correspond to the same destination. This is why all past trip destinations are first clustered. The most common and well known clustering methods did not suit our needs here. The need of many of them to define the number of clusters beforehand was ridiculous for this purpose. Also, the situation in which two locations a couple of kilometers apart end up in the same cluster does not make sense. DBSCAN seemed like a good idea, since one of the parameters is the distance in which to consider neighbors. But this can also result in situations where neighbor of a neighbor of a neighbor ends up very far away, but is in fact part of the same cluster. So we had to come up with a new method which would work logically for our specific purpose. We ended up using a heavily modified version of k nearest neighbors algorithm. One destination clustering example is shown below. Of course, if you prefer you can manually enter your points of interest, like home or work, and we'll use that location instead.
Another thing to keep in mind is the recency of past trips. A trip you did yesterday is more relevant than the one from 6 months ago. As a result, it should be possible for example to change what system learned about your workplace if you change jobs. However, it shouldn't be too jumpy – you could be attending a conference at a different location for a couple of days. We wouldn't want the navigation system to change preferences immediately. But it should change after a certain time, maybe a couple of weeks. The key here was finding the sweet spot. We performed the accuracy tests on a number of vehicles to fine tune this parameter.
It would be beneficial if the AI model could not only tell the most likely destination, but instead output a list of destinations, sorted from most to least probable. That way the GPS navigation system could show the user top 3 or 5 most likely destinations to choose from. If turn-by-turn navigation to a specific location is not activated, the system will alert you as if you’re driving to your most likely destination. If during a trip a significant divergence is noticed from the most probable path, the system will switch to the next destination that is still probable due to the course of trip so far. This means that if you’re actually going to a location that the system initially thought as second most likely, when it realizes you are not travelling in the direction of the most likely location, the system will switch to your actual destination and start alerting you what’s up ahead with that in mind.
To sum all the prerequisites up, the likely destination model should:
- be able to handle complex circumstances and driving patterns
- be able to recognize which locations belong to the same final destination
- take trip recency into account
- be able to give a list of ranked destinations as a result
- be able to switch to the next most likely destination while driving
We then used machine learning to create AI model that finds patterns and figures out where you might be going based on your trips history. Of course, we were interested in maximizing the model accuracy. We defined it as a percentage of destinations guessed by the model. However, it was important to simulate conditions in which the model would be used. For each trip, we would create a model that learned about all the trips preceding it. In other words, we would pretend that we have data only up to a point before the trip we wish to evaluate. And then we would compare the real trip destination to the predicted one based on the knowledge before that point. This way we created a testing procedure where the data on which we test the model is completely independent from the data on which the model is made.
Regarding the AI model accuracy measurement, there are a couple of things that need to be emphasized. First, predicting destination from past behavior means that the model will do a good job anticipating your next destination if that is something you normally or even sometimes do. If you break your record of going straight home after work one day to grab a drink – the model won't anticipate it because it has never seen you go there. But if you do it a few times then it will quickly become one of most likely destinations under similar conditions. Second, there are situations when it’s absolutely ok for the model to make an incorrect prediction. For each of us there are situations when we don’t go where we usually go in similar circumstances. In such situation it is natural for the model to expect us to do what we usually do. We just didn’t follow our usual pattern. And finally, in terms of accuracy, there is no one single number that should be regarded as satisfactory. Some drivers rarely diverge from their patterns, while others have almost none. For example, someone using his vehicle for a delivery service – in that case some locations might repeat, but most of them are impossible to anticipate. In the first case, anything below 8 out of 10 correctly guessed destinations might be low, while in the second 4 out of 10 might be a huge success. This is why there was a lot of manual checkup to make sure destination predictions make sense in the context of each driver. It is also for these reasons that trips to completely new destinations were excluded from evaluation. We wanted to measure the proportion of correctly guessed destinations out of ones that the model had at least a theoretical chance of guessing right.
The prediction accuracy we obtained on a mixed collection of vehicles was 61%. However, the accuracy varied a lot between vehicles, ranging from 41% to 76%. When testing the proportion of cases where the true destination was among the top 3 most likely destinations, the accuracy rose to 73%. In this case, the accuracy range was between 52% and 92%. But what is most important is that the manual inspection showed the AI model always made sensible predictions, and wrong guesses stemmed either from driver behaving against his patterns or absence of notable patterns to begin with.