When consumers use money management tools, they normally receive a historical view of their finances. But how useful would it be for them to also see their financial future? To be able to confidently know how much money they will have next week? This is something our development team at Moneyhub Enterprise have been researching. Our new Balance Prediction technology — which uses machine learning, crowd psychology, deep learning and some good old fashioned match-making — will enable our personal finance management (PFM) tools to quite literally be fortune tellers.
PFM user scenario
Picture the scene — Joe Bloggs is looking at his bank balance and it actually looks pretty healthy! He’s got more in the kitty than this time last month … but does that really equate to having more to spend? Finances are often pretty complicated, so before he starts splashing the cash, he might ask himself:
- Why do I have more? Did I spend less or earn more?
- Do I have upcoming bills that will negate this surplus?
- Is this just money I’ve moved around?
- Did I spend more on my credit card than usual?
- Did I transfer as much to my savings as usual?
- Was it just a short month? (I’m looking at you February…)
- How is my progress towards saving up for that holiday/car/house?
So many questions and they can be pretty difficult to answer. Our mission at Moneyhub Enterprise is to help make sense of the end user’s finances and enable them to be as financially well as possible. Which is why we’ve recently been working on balance prediction technology, because we know it’s the next step needed to help people manage their money effectively.
So how does it work?
In order to apply balance predictions on a large scale, we incorporated studies around Crowd Psychology, Herd Behaviour and Group Dynamics. We live in a connected world where we are influenced by other people. Their influence extends to how we spend our money. Without going too much into social psychology, the crux of it is that your spending habits are not as unique as you might think they are! So for the vast majority of people there will be someone else who spends their money in a similar way. So assuming we can find someone with similar spending habits to one of our users — so what? How does that help? Well, actually simply finding a matching user is not very useful. What we really want is to find matching spending from some point in the past. By analysing past spending habits, we can then use this data to predict the matching user’s future.
Think of it like a match-maker for a dating website, except that instead of matching up people we match up balances. Just like in love, a match is successful if the pair stay close to one another as time goes on. We want to find two balances that will align closely over the period we wish to make a prediction for.
An alternative approach might be to extract trends in the user’s spending – looking at each person in isolation. One problem with this is that you are always playing catch-up. It also very much depends on them having some identifiable regularity in their spending, but what happens when they get married/ go on holiday/ have a child? Spending might be regular for a time but this will often not last very long. Even once your spending returns to a regular pattern, an algorithm like this will need regularity to play out for a while before it can revert back to accurate predictions.
So how will our approach fair any better? We don’t need regularity – what we need is a match. Lots of people go on holiday, and lots of people will spend their money on holiday in a similar way to one another. Having children is a pretty common life event and how it affects your spending is more than likely going to be the same way it has affected someone else’s spending. In many cases there will be cues in the lead up to a life event, so by matching up balances these cues can be found and our predictions can react faster and even preemptively adapt.
Finding potential matches
So now we are searching through every point in history for a potential match. This poses us with a bit of a problem. Let’s look at an example. Suppose we have 10,000 accounts each with 1000 days worth of historical balance data and we are looking at time-frames of 30 days. We then need to perform our calculations over 9.7 million items. What’s more, this is an exponential problem. With more data, the search space gets bigger, and with more accounts we have more predictions to make. To solve this problem, we looked at ways to quickly refine the list of potential matches down to a much smaller list. We did this by analysing some metrics such as the mean and standard deviation and then reducing our list of candidates to those with similar metrics.
What is a good match?
So, if we find a number of balances that closely follow our candidate’s balance, then how do we decide which will give the best prediction? This is where Machine Learning and Deep Learning techniques can really shine. You could imagine attempting to solve this problem by doing some further analysis – trying to find trends on what will most likely produce a good match. That could be a lot of work so thankfully there are free tools available to help. By using a learning algorithm, these trends and patterns are discovered for us. Instead of needing to worry about all the analysis we would need to do to extract those patterns – we need to think about which tools to use, in what order, and how to feed the data to it.
To perform our learning we used Tensorflow which was developed by Google. In particular we used their Wide and Deep learner which also powers Google’s recommender system for the Play Store. Tensorflow is not just a library of Machine Learning models, it’s much more flexible than that. The Tensorflow tutorials provide great examples of the different models.
We chose to use a Wide and Deep model because it takes advantage of the best of both Wide models and Deep models. Wide models being Linear classifiers and Deep models as in feed-forward neural networks; together we get the benefits of memorisation and generalisation. By generalisation we mean trends or rules. So returning to our problem, an example of generalisation would be that a match is more likely when both of the accounts are the same type of account (both current accounts). Memorisation is learning that a specific set of conditions gives a specific outcome. To find out more you can read this research paper published by the developers of the model.
After training our model, where does this get us? Well not only can we choose the match that is most likely to give us a good prediction – but we can also find out how accurate our predictions are. In some cases we might not find any matches for which we have enough confidence to actually use as a basis for the prediction. In that case we might choose to search more thoroughly for a match (remember the refined search) and if we still get nothing, we would try a completely different approach for forming the prediction. At present our model is at least 80% accurate as a whole which means that we can have a high level of confidence that the predictions we give our end users will be good predictions – the problem that remains is the difficulty in finding a match for some candidates. However, we have a number of specific solutions we use to combat this.
We also put our end users’ transactions into a number of categories. This helps them to get a handle on where their money is going, whether it’s entertainment, eating out or bills. This also gives us some powerful information to enhance our predictions. You might not be convinced that your spending can be so easily matched up with another person’s – and you might be right. But what about just one facet of your spending? For instance, how you spend your money on food shopping? If we can match a subset of your spending to some other spending in the past then by doing this repeatedly – finding a match for your entertainment, then for your eating out and so on – then we can build up a holistic picture of all your spending.
Garbage in - garbage out
An important lesson we learnt along the way is that you need to be careful exactly what data you use to train your model. Remember how we used some metrics to reduce the search space for matching candidates? Well, when we first attempted to train a model we used all of the data from this initially refined search. The problem with this is that there are a number of accounts which are not doing very much for the majority of the time – so it’s possible to get a good prediction in the short term even though the match is not really a good match.
When you train a model, you’re giving it all these examples to learn from. It learns by you telling it if the match is good or not. But if you tell it that something is a good match, however, in reality it’s only good in the short term by chance then you are giving it a false signal. And as they say, garbage in – garbage out. The machine can’t learn to distinguish between good and bad if you don’t tell it the truth! Sounds pretty obvious when you put it like that, but it took a moment to realise that this was effectively what was going on.
How can predictions help in practise?
Using our existing technology as an example, this is how balance predictions can enhance the end user’s financial wellbeing:
1. Visualise the future – planning
At a glance, seeing that their balance is about to take a nose-dive will stop the user from over-spending. Or on the flip side, seeing that your balance is going to continue to be healthy could give you the peace of mind to buy that new TV, or to move some money into an investment. So short-term predictions can help with short-term planning. The same could be said for long-term predictions, but that’s another kettle of fish.
2. Stay in the black — shield against fees
Using predictions, we will give the end user a warning when they are at risk of becoming overdrawn. They can then take action and prevent themselves from incurring any fees. The user might find this useful with other personal financial goals as well, so we want to let our users choose the limit that they would like to be alerted about.
3. Motivate saving — future proof finances
The user might look at their predictions and think, “Hmmm, I could do better than that”. This instinctively motivates the user to be savvier with their money. This also has the potential to be gamified into a “beat my predictions” function.
4. Spending Goals — enhancing other features
When drawing up spending or saving goals in our app, the balance predictions can be used as a guide towards creating realistic and achievable goals. The same applies to our forecast feature — balance predictions can improve and enhance other activities in Moneyhub.
Balance predictions is something we continue to research and progress. Just like Doc Brown and Marty McFly found out, there really is something about going back to the future.
Written by Matt Sinton-Hewitt, Software Engineer at Moneyhub Enterprise