Predicting cash withdrawals from an ATM using a simple neural network

Tomcat

Professional
Messages
2,656
Reputation
10
Reaction score
647
Points
113
fabd78966c4947e588a28c979f9c5391.jpg


Perhaps you have ever encountered an ATM in the “Out of service” mode.

One of the possible reasons for this condition is the lack of electricity in the money cassettes.

To prevent this from happening, banks are interested in knowing the future - how much cash will be withdrawn from ATMs and when the money will completely run out.

Below is the solution to this problem using a simple neural network.

First, let's figure out what a neural network is. From an amateur’s point of view, a neural network can be imagined as a kind of “black box” that takes as input and produces a certain set of parameters as output. To train a neural network means to train it on a reference set of input and output data, which is called the training set.

Let's look at a simple example.

Let's learn how to use a neural network to find the value of the "Exclusive OR" function.

595ff83cf2d34ef28ea19c10ff47c5af.png


Here, on the left, a and b are the input parameters, and on the right, a⊕b is the output parameter. Having trained a neural network on a truth table, we can feed any combination of zeros and ones to the network input and get the correct result at the output. An attentive reader noticed that no matter what value of zeros and ones we take after training, it will coincide with one of the training pairs. In real problems this is usually not the case.

Let's return to our ATMs.

To make predictions, you first need to figure out the signs on which the amount of funds withdrawn depends. This is done by analyzing statistics and applying common sense. Thus, it was discovered that the amount of money withdrawn on the same days of the week is usually similar.

To forecast for Monday of “Week 3”, data for the two previous Mondays is supplied to the input of the neural network. This neural network is good, but it is not able to predict the peaks of cash withdrawals on specific dates of the month (salary?).

For the forecast for the 5th day of “Month 3”, data for the 4th, 5th, 6th of the previous two months is input (this helps improve the forecast if the “peak” day is moved ±1 day due to a holiday or holiday).

The result could be the average of the predictions of the two previous neural networks.

In order not to violate corporate secrecy by inflating the article, some important technical details were omitted from it (types of neurons, types of training, data normalization, and others). But I hope that the uninitiated reader has an idea of how this thing works.

Note to the hostess
For implementation, the Encog machine learning framework (available for .Net, Java and C++) was used. It allows you to create neural networks at a high level, specifying the types of neurons and their number in each layer of the network:
Code:
var network = new BasicNetwork();
network.AddLayer(new BasicLayer(null, true, 2));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 3));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 1));
network.Structure.FinalizeStructure();
network.Reset();

If you don't want to understand the rather complex mathematics of neurons and learning methods, I recommend finding a ready-made library for your language.
 
Top