Using artificial neural networks to solve banks’ problems

Adam Maj
8 min readOct 29, 2019

You’ve probably heard stories of your great-great-great-grandma storing stacks of cash under her bed or in some safe “cleverly” hidden behind a painting on the wall of her house back in the day. What would happen if an unwanted guest broke into her house? They would be able to take all of grandmas life savings in one fell swoop! That would not be a good situation for grandma, and it would be in her best interest to keep her money in a bank instead.

Unlike grandma, people who store their money in banks don’t have to worry about robbers breaking into their houses and stealing their life fortunes. Banks certainly provide a valuable service to their customers and frequently help people like grandma by keeping their money safe. However, as much as banks are able to help all of us, we might actually be able to help them!

Why should you care about banks?

Today, over 5 billion people worldwide have a bank account. People often turn to banks for financial stability and security. Banks protect your money for you and you don’t have to worry about hiding the money yourself and keeping it secure. Even if the bank you store your money in goes out of business, you won’t necessarily lose your money. The government insures your money that’s stored in banks so you will get your money back if a bank closes down (as long as you have less than $100,000 in your bank account).

Banks increase the flow of money in the economy. When you deposit money into a bank, the money doesn’t just sit there until you decide to withdraw it. Instead, the bank loans out this money to other people who need it. They can then spend this money, which stimulates the economy.

Here’s an example of the money flow brought about by a bank

Banks are important institutions to keep the economy running smoothly. Without them, we would have minimal financial security as our money could be stolen or destroyed at any time. Furthermore, the economy would be significantly worse off without them.

How do banks earn money?

Despite their association with the government, banks are private institutions. This means that in order to stay running, they need to earn money and make a profit. How do they accomplish this?

Banks earn money by charging interest on the loans that they give out. Unfortunately, loans aren’t just banks giving out free money to people (wouldn’t that be nice). When you take a loan out of a bank, you have to pay back the amount of money you borrowed plus a small upcharge. You can make this payment incrementally over the following years. The small upcharge that you have to pay to the bank is called interest, and this is where banks earn the majority of their profits.

That being said, banks are not perfectly safe businesses which always steadily earn money. There are risks in running a bank.

What could possibly go wrong?

In order to earn a profit, banks need customers to store their money in the banks. Then they can loan out this money and earn a profit on it. However, when people holding money with the bank want to withdraw their money, the bank needs to be able to give them what they want. They need to make sure that they don’t loan out so much money that there is nothing for the account holders when they want to withdraw.

If too many people withdraw money at the same time, and the bank has given away too much of its money through loans, it will not have enough to provide money to the people withdrawing. In such a situation, the bank can go bankrupt. In some cases, these situations have happened in banks all across the country, leading to confusion and an economic downturn.

The situation described above is almost exactly what happened during the famous housing market crash of 2008. Banks were giving out too many loans to people for the purpose of buying houses (this kind of loan is called a mortgage). Due to the poor screening done by the banks, many of the people who recieved loans were unable to pay the bank back and the banks began to lose money.

When people caught wind of this, people all across the country tried to withdraw money from the banks. Due to this mass withdrawal, many banks were unnable to pay back their customers since they had loaned away all of their money and many banks went bankrupt (mind the pun).

How can we avoid this?

It's clearly not a good thing when banks go bankrupt on a largescale. When this happens, millions of people are harmed and the economy suffers. As we have seen, banks can often go bankrupt when many people want to withdraw all their money from a bank at the same time.

If only there was a way to predict how likely customers are to keep their money with a bank versus taking all their money out and leaving the bank. Banks would be able to use this information to gauge how much they could loan. If a bank knew that certain customers were likely to withdraw their money and leave the bank, the bank could save enough money to give to these customers and then loan out the rest. This would help banks to avoid problematic situations.

Luckily for banks, there is a way to predict this statistic. We can use artificial intelligence to train an algorithm which will then predict if customers are likely to remain with a bank or withdraw all their money and leave. More specifically, we can use something called an artificial neural network (ANN) to make this prediction.

My project: creating the artificial neural network.

I decided to create my own artificial neural network to solve the problem described above. The goal of my ANN is to predict whether customers are likely to keep their money with a bank or leave a bank within the next six months given specific data points about customers. At this point, you may be wondering how exactly an ANN works and how I used one to solve this problem. Don’t worry, I’ll answer both of these questions.

What is an ANN?

An artificial neural network is a type of artificial intelligence that makes networks of “neurons” to analyze data and draw conclusions about different problems. Neural networks are made to model the human brain.

In short, ANNs are designed to make certain predictions based on the data that they are given. They take the data as inputs and then attempt to make a prediction about the data as an output.

In the diagram of an ANN below, each circle represents a neuron, and each column of circles represents a layer. The lines connecting all of the neurons together are called weights. The weights are what connect different data points and determine the correlation between different factors in the problem. Having accurate weights is one of the most important differentiators between a functional neural network and a fancy math equation that spits out random numbers.

This is what an artificial neural network looks like.

Initially, data is fed into the input layer. It is then passed into the hidden layers, which is where all the magic happens. In this section, the data is interpreted by the neural network and correlations are made between the data and the predictions. Finally, the neural network makes a prediction about the data and feeds it into the output layer. The value in the output layer will be the prediction that the neural network has made.

If you want to learn more about how ANNs work on a technical level, here is a great video.

Using ANNs to analyze bank customer data.

Despite now knowing what an ANN is, it might not be obvious how to make use of one in this specific case. Does this problem fit into the types of things that artificial neural networks can do? We need to predict whether customers will stay with or leave a bank based on certain data about them. In this case, we have definite data to feed into the neural network, and we are trying to predict something specific. Thus, we can make use of an artificial neural network to get the job done.

Implementation of the ANN

In this case, the neural network uses specific data about customers to make a prediction about them. Information about the customer’s country, age, bank balance, salary, and other such factors were used to make the predictions. The ANN trained on this data and tried to make correlations between this data and the likelihood of whether the customer would leave the bank. After making these correlations, the ANN was then trained and was able to make accurate predictions about the customers.

I personally decided to create my ANN using a programming language called Python. After some training and testing, my neural network was able to make predictions about bank customers with ~85% accuracy! If one person is able to make an algorithm with that accuracy, imagine how accurate of an algorithm an entire team of people could make and how much value this would contribute to banks!

Checkout my ANN!

You may be wondering how my program actually works or if you could make something similar yourself. Check out my code complete with a detailed description of how everything actually works HERE

Key Takeaways

  • Banks provide financial stability and security to many people and they stimulate the economy.
  • Banks earn money by taking a small upcharge on the money they loan to people. This upcharge is known as interest.
  • Banks can get into trouble if they loan out too much money and customers want to withdraw money
  • We can use an artificial neural network to predict whether customers are likely to keep their money with a bank or withdraw their money and leave a bank. This would help banks out as they would be able to determine how much money they should be loaning out.
  • ANNs are algorithms that attempt to simulate the function of the human brain to make correlations between data points and make predictions. We can use them, in this case, to help out banks.

Wait… don’t click away yet!

I’m Adam, a 16 year old passionate in technologies like artificial intelligence/machine learning, blockchain, quantum computing, and much more.

If you enjoyed learning about this topic or are interested in modern technologies and artificial intelligence, make sure to: