Digital Developer Conference: Hybrid Cloud 2021. On Sep 21, gain free hybrid cloud skills from experts and partners. Register now

Demand forecasting using deep learning


This pattern demonstrates how to use deep learning to forecast the demand for cash vending machines. It’s important for financial institutions to ensure that the cash vending machines don’t run out of money, which can increase the revenue and enhance customer experience.


Forecasting for cash vending machines can be demanding with various reasons for dips and spikes in the demand, such as weekday, weekend, location, beginning and ending of the month, and holidays. The biggest challenge is to remember the pattern of withdrawals with respect to the reasons stated previously. This is where deep learning comes into the picture, and we are referring to recurrent neural networks (RNN). The long-short term memory (LSTM) is a type of recurrent neural network. An RNN is a special type of neural network that is designed for sequence problems. We will be creating a sequence prediction LSTM model that can predict the next value when given an input sequence.

But why use deep learning for this? We need to mimic human behavior of cash withdrawals by remembering the recent past and then use what is learned to predict the future. We create the neural network model with recurrent layers, which process the information through the looping architecture of the network and generate the corresponding output. This produces accurate forecasts of cash demand, which in turn optimizes cash replenishments of the cash vending machines.

After completing this pattern, you understand how to:

  • Create a deep learning model using LSTM
  • Tune the hyper-parameters of the model
  • Use transfer learning using LSTM
  • Generate new forecasts on new data using the same model and weights
  • Use a cross validation technique for evaluating accuracy
  • Use a grid search technique for fit and score using different parameters


Forecast demand flow diagram

  1. User uploads the first input .csv file onto Object Storage.
  2. User runs the Notebook that will create a deep learning model and churn out forecasts.
  3. User uploads the second input file onto Object Storage.
  4. User runs the Notebook again using transfer learning of the deep learning model, and generates the forecasts.
  5. User learns how to create a deep learning model to be used on different data sets and achieve good accuracy.


Find the detailed steps for this pattern in the readme file. The steps show you how to:

  1. Create a deep learning model using LSTM.
  2. Understand and tune the hyper-parameters of the model.
  3. Transfer learning using LSTM.
  4. Generate new forecasts on new data using the same model and weights.
  5. Use cross validation techniques for evaluating accuracy.
  6. Use a grid search technique for fit and score using different parameters.