Development of Cloud Software

AZUR Innova is an exciting Cloud initiative. Its main goal is to boost the proficiency of business unit stakeholders with a unique Optimized Agile Solution. It offers a very efficient way to develop high quality Cloud solutions for medium and large businesses.

LEARN MORE

Smart Treasury Management Solution

EFS is a Canadian and multilingual solution developed by local treasurers. It is flexible and adaptable to your cash management needs. It enables treasurers and CFOs to simplify and automate their operations, improve decision-making and ensure optimal risk management.

LEARN MORE

Blog

Articles

25 January 2020

Using AI to automate transation reconciliation and prediction to generate smart rolling forecasts (SRF) by Jean-Louis Lalonde, CEO of AZUR Group

The world’s most valuable resource is no longer oil, but data. – The Economist

Transaction matching and prediction are two top AI scenarios in treasury management.

Time is money and not managing risk levels can be disastrous. Accurate predictions are crucial to reacting quickly and better anticipating events that could have a profound impact on your company. AI algorithms use existing data to pinpoint trends, identify risks, and provide better financial information for future planning.

For most treasury departments and SMEs, developing machine and deep learning models from scratch to improve their treasury operations is neither easy nor affordable. Moreover, talent shortages remain a huge hurdle and a lack of qualified talent is often the biggest challenge facing their business.

That’s why, at AZUR Group, our goal is to democratize AI through affordable and specialized smart software solutions. Fortunately, AI models can be developed, reused, and adapted to improve their performance one customer at a time, letting you add AI to your treasury operations without the need to hire data scientists. AZUR Innova’s AI models can be reused and delivered to our customers. The models are stored in online containers and consumed securely via AZUR Innova’s APIs.

The use of AI in the corporate finance world may be new, but it’s likely to become indispensable in the future as multifaceted finance calculations increasingly involve more complex data than any human can accurately model.

Treasurers, CFOs, and accountants can become familiar with AI by selecting high-value AI scenarios with great ROI to drive down costs and grow revenue. The adoption of predictive analytics is one area where AI can assist financial experts, making them much more efficient and able to accurately predict likely financial outcomes. A wide variety of statistical and machine learning techniques is needed to assess current and historical facts and make predictions about future events. The predictive model can identify risks and opportunities by exploiting patterns found in historical and transactional data.

To leverage the power of AI in cash flow forecasting, we decided to build a smart rolling forecast (SRF). As SRFs rely on predictions for cash inflows and outflows, AI is an invaluable tool that can use data from various systems to generate such forecasting. Even though many companies still create their forecasts using old-fashioned spreadsheets, we intend to demonstrate why they should be replaced by machine learning algorithms and other AI tools.

To achieve this vision, at AZUR Group, we are currently implementing a smart rolling forecast module in EFS, our smart treasury solution.

In this article, we will explain how we developed the AI foundation of EFS’s smart rolling forecast. We hope that, with this innovation, the SRF module will help Canadian companies better navigate today’s complex digital era.

Harnessing the power of AI

Our main goal for 2019 is to deliver the best robo-treasurer in an affordable and multilingual SaaS solution that meets the needs all large- and medium-sized Canadian companies. Last year, AZUR Group launched a major R&D project for AI in business processes. The first step was to build a generic AI framework that could then be reused and applied to specific business problems. The second step was to build a proof of concept to significantly reduce repetitive and low-value tasks in any business management process. The ultimate objective is to create an environment in which humans and software robots can work side by side with virtual interactions provided by the next generation of 5G mobile networks by 2020. An SRF is a standard rolling forecast that’s automated using multiple intelligent robo-treasury tasks, eliminating the need to do the same tedious, error-prone manual operations each day. An SRF is an opportunity to design an efficient and optimized forecasting process to rapidly, continuously, and intelligently predict the future of your business that provides your executives with a variety of likely outcomes based on a range of options. To free treasurers, CFOs, and accountants from manual operations, our SRF incorporates a multitude of robo-treasury tasks implemented with AI algorithms, such as:

  • Auto-categorization of bank statement items
  • Auto-matching of statement items with predicted transaction amounts of your forecast
  • Auto-generation of transaction amounts to build a forecast of at least three years with high-quality predicted values
  • Auto-generation of another month at each month-end to maintain a rolling forecast of at least three years
  • Auto-detection of anomalies (abnormal transactions) to generate alerts of potential fraud
  • Auto-recommendation of personalized information about how to improve your forecasts and optimize your investments (maturities, rates, terms, conditions, etc.)
  • And more!

To reduce manual operations, make EFS more automated, and enhance the user experience, several scenarios incorporating AI techniques were tested. To do so, in September 2018, we launched a proof of concept with two main objectives:

  • Design the basics of a reusable AI platform for future client projects
  • Design effective AI algorithms applied to cash flow management

To ensure a smooth transition from traditional cash flow to AI-based cash flow, it is necessary to proceed in a safe and calculated manner. Since using new smart tools designed to help you manage your cash flow is becoming commonplace, it is crucial to establish a game plan using a proof of concept to develop the proper onboarding process for each new customer.

Leveraging a proof of concept

Every company that wants to migrate its processes to smart cash flow management software must have an onboarding plan. A proof of concept makes it possible to develop an experimental, concrete, and preliminary system that provides a clear picture of what the smart cash flow management application can do. A proof of concept allows you to design an AI algorithm that predicts cash flow according to the data flow history of each category. A proof of concept lets you not only get a preview of the results, but also:

  • Reduce the time spent analyzing the data history
  • Reduce the time spent doing transaction categorization
  • Reduce the time spent doing transaction reconciliation
  • Increase the quality of matches between actual and predicted transactions
  • Reduce the time spent on calculations and creating expected cash flows
  • Increase the quality of forecasts to better predict the future
  • Reduce fraud with smart alerts

Calculating the ROI of your AI

Most AI implementations currently target call centres or back office operations where there are endless manual, repetitive tasks. ROI calculations can help you quickly figure out the best business scenarios to start with: how much time AI will save, how many human errors will be avoided, how much better your customers will feel when interacting with your employees. A great AI ROI should be obtained within two years. We need to analyze the impact of AI and focus on enhancing the labour force to improve customer and employee experiences. It’s imperative to validate how AI can enhance your employees, not replace them, by understanding the human processes that are driving your business.

Designing an AI algorithm

To design our SRF, we tested several AI algorithms to achieve the following treasury scenarios:

  1. Automatic categorization of transactions
  2. Automatic reconciliation of transactions
  3. Automatic forecasting of future cash flows

At AZUR Group, we have built a team of data scientists with proven track records of AI knowledge and applied AI. Some of our experts regularly compete in Kaggle competitions solving complex AI problems.

The AZUR approach

To get the best results for our three treasury scenarios, our data scientists tried and tested various data transformations and AI machine learning algorithms. To build powerful algorithms, the tasks are divided between two main stages: feature engineering and modeling. Feature engineering is critical for model performance because this is what makes the data digestible for the modeling algorithm. For example, text mining approaches are used with text data, ratios are calculated with numeric data, and similarity calculations are made between different character chains.

Calculating similarities between text strings

The elements that can be used to reconcile actual and predicted transactions are often found in textual data from both of these sources. Consequently, for a given pair of actual and predicted transactions (multiple pairs are considered), all the text variables in the actual data and all the text variables in the predicted data are concatenated into two separate strings. An algorithm then evaluates the similarity of the two resulting text strings by searching for 3-, 4-, and 5-grams (the “3-grams” of “abcdi” are “abc,” “bcd,” and “cdi”) that are found in both strings, while also considering the length of the text strings.

Choosing the best algorithms for our three treasury scenarios

For machine learning algorithms, our team tried various algorithms such as random forest, gradient boosting, and neural networks. They found that a gradient boosting algorithm, especially LightGBM, works very well for the first two scenarios, in combination with many relevant data transformations. For the third scenario, we rely on recurrent neural networks to generate the cash flow.

What is a gradient boosting algorithm?

Wikipedia defines gradient boosting as a “machine learning technique for regression and classification problems, which produces a prediction model in the form of an ensemble of weak prediction models, typically decision trees.” Gradient boosting is attracting attention for its prediction speed and accuracy, especially with large and complex data sets. Every month, many new machine learning algorithms are designed. Among the new algorithms that have emerged in recent years, LightGBM stands out as a highly efficient gradient boosting decision tree.

LightGBM: the best algorithm for automatic transaction categorizations and reconciliations

Before we talk about LightGBM, it’s important to understand how a decision tree algorithm works. To do so, you need to grasp the concept of nodes and leaves. When we develop a decision tree algorithm, we start with our entire data set (root node), which we then split into two sets (internal nodes) according to a criterion that differentiates the two sets as clearly as possible, using either a target variable or a category. Every time a new node is created, it is split in this same way. Once there are no more gains in performance to be had by making new splits, we stop building the tree. The final nodes thus become terminal nodes (or leaves) that represent groups of observations (in our case, transactions) that share similar characteristics, but that differ from the transactions of other groups. Without going into too much detail, LightGBM doesn’t build trees in precisely the same way as most other gradient boosting algorithms. While many gradient boosting algorithms build decision trees from top to bottom by automatically adding new splits for all nodes at the same level, LightGBM seeks to find the best split to make for each node. The following diagram illustrates this difference: Here’s how most gradient boosting algorithms build decision trees: And now, here’s how LightGBM builds decision trees: This difference in how trees are built and how the algorithm handles continuous numerical values provides numerous advantages:

  • Faster training
  • Better accuracy
  • Reduced memory usage
  • The ability to handle large volumes of data

What is a recurrent neural network (RNN)?

Wikipedia defines RNN as a “class of artificial neural network where connections between nodes form a directed graph along a temporal sequence. This allows it to exhibit temporal dynamic behaviour. Unlike feedforward neural networks, RNNs can use their internal state (memory) to process sequences of inputs.”

RNN: the right choice for automatic forecasts of future cash flows

Traditionally, time series approaches have been used to solve problems like the one we’re interested in—that is, predicting future transactions. However, in the context that we’re interested in, this kind of approach would have required us to parameterize and adjust a series by prediction category, by account, and by company. That’s a lot of time series to consider independently. Recurrent neural networks (RNNs) are very good at language processing. For instance, predicting the word (or words) that complete(s) a sentence is highly dependent on all the words that come before it (including their order) and not just the previous word. RNNs have the capacity to take previous words and their order into account. We can draw a parallel with our current need to predict future amounts for a given category based on past transactions. These are the main advantages of using this type of model:

  • Generating daily predictions
  • Integrating predictions for all subcategories into one model
  • Taking into account highly complex correlations
  • Extending the prediction period of interest
  • Possible predictions for subcategories that the model never encountered during training

Reusing a sufficiently trained and effective model for other, similar tasks

Using MLS to implement AI solutions

To implement our AI algorithms in EFS and to implement its SRF module, we used the Azure Machine Learning Service. As per Microsoft’s service description, “Azure MLS is a cloud service that you use to train, deploy, automate, and manage machine learning models, all at the broad scale that the cloud provides.”

Figure 1: Microsoft MLS process and services Typically, AI developments follow these steps:

  1. Import the training data.
  2. Prepare the data with Python scripts.
  3. Train the model with specific functions or libraries.
  4. Save the trained model in Microsoft Azure Machine Learning Service (MLS).
  5. Build an image which represents the machine on which the model will be executed.
  6. Deploy the image as a web service.

Once the model is trained and deployed as a web service, it can be consumed securely from an application, whenever it’s time to leverage the AI algorithm.

Figure 2: AI model architecture on Azure In the case of EFS, the cash flow forecast is implemented using the following services:

  • MS SQL Azure – data storage
  • MS Azure Data Factory – ETL tool for transferring data from the operational databases to the AI training databases

The high-level stream of the EFS vs. Azure MLS process is as follows:

  • EFS maintains data from each “tenant” in operational databases.
  • At regular intervals (on demand or on a schedule), data is transferred via the Azure Data Factory to a centralized database specific to the AI model training.
  • At the end of the data transfer, the AI training is triggered.
  • Once the training is complete, the predictions can be written directly in the AI BD.

Getting results: auto-categorization

Algorithms were trained and tested on three different data sets, representing real companies with different characteristics. Here are the defining characteristics of each of the three data sets:

  • Company 1: Small number of transactions (1,600), spanning approximately 14 months, split into many categories (73). For most categories, transactions occur irregularly.
  • Company 2: Large number of transactions (120,000), spanning a few months, split into 179 categories have a variety of distributions: several regularly recurring categories, with a recurrence pattern that is clearly visible on charts; and several non-regular categories or categories with few transactions, without any observable regularity.
  • Company 3: Large number of transactions (80,000), spanning a few months, split into 28 categories, most of which recur very regularly.

The performance of trained models varies greatly depending on the data sets. Interestingly, the performance of data sets 2 and 3, which include a large number of transactions, is by far the best. What’s more, performance is highly dependent on the rigour and consistency with which previous categorizations were made manually, since this is what the algorithm is based on during training and also what it is validated against. In addition, when a large number of transactions are available for a company, the best performance is obtained by using a recent data set for training, which shows that the way transactions are manually categorized is constantly evolving. The best results for the three companies, obtained by filtering the learning data whenever possible (companies 2 and 3), are as follows:

  % of transactions that were properly categorized*
Company 1 63 %
Company 2 97 %
Company 3 99,5 %

 

Getting results: auto-reconciliation

We used company 2 to train a smart auto-reconciliation algorithm. The data from this company was well suited to this exercise because of the high volume of daily transactions and because considerable effort is spent on this important treasury management task every day. An automatic reconciliation system based on a few business rules made it possible to reconcile 84% of actual and predicted transaction pairs for a given day that had not been used to train the algorithm. The addition of a smart auto-reconciliation algorithm made it possible to increase the percentage of automatically reconciled actual and predicted transaction pairs to 96%.

Getting results: predicting cash flow

Recurrent neural network algorithms were trained for the data of the three companies. First, short-term prediction models were used to validate performance. Even if long-term forecasts are required, it’s still a good idea to make sure short-term performance is good before extending the prediction period. You don’t want to amplify a short-term problem over the long term. Over 28 days, root mean square error (RMSE) was calculated for the data-adjusted algorithms of the three companies. An algorithm trained on all available data, no matter the company, was also used. What is root mean square error? It’s a measure used to quantify the average error produced by the model. To calculate it, first you square the differences between predicted and actual values before adding them up and dividing the result by the number of predictions. Finally, the square root of this number is calculated to get the RMSE. Note that in the current example this metric was calculated on transformed data, on a scale that is not in actual dollars. Keep in mind—the lower the RMSE, the better! These were the results:

  RMSE on transformed validation data
  Company 1 Company 2 Company 3
Algorithm trained on company-specific data 0.0120 0.0310 0.0276
Algorithm trained on all available data, no matter the company 0.0121 0.0306 0.0246

 

It’s interesting to note that, for two of the three companies, the global algorithm performs better than the specialized ones. For company 1, the results are virtually the same. This indicates that each company benefits from the knowledge that the algorithm gleans from the other companies. Teamwork results in better predictions! The issue of making predictions for a large number of categories at the same time, which may number in the hundreds for some companies, is an interesting one. To fully understand the potential of recurrent neural networks, consider the following algorithm predictions compared to actual transactions for company 2 (dollar amounts have been withheld). Black line: actual transactions Blue line: transactions predicted by the algorithm Category 1 Category 2 Category 3 Category 4 We can see that, although there was no clear visual trend for the period in question, the predictive algorithm was able to fairly accurately forecast various changes in cash flow at the right times. Consequently, since short-term results have been verified as good, we can now generate long-term predictions. Without a sufficiently high volume of data to validate multi-year predictions against, only time will tell if our predictions are correct.

An affordable and flexible solution

To succeed in today’s complex digital era, companies need to be able to make fast and accurate cash flow predictions. But yesterday’s spreadsheets simply can’t keep up with the volume of data and the rate of change. While AI offers an obvious solution to this problem, for many companies, implementing AI is far too challenging and expensive. That’s why, at AZUR Group, we’ve developed an affordable AI model that can be adapted to your company’s specific and evolving needs. At AZUR Group, we’ve harnessed the power of AI in a smart rolling forecast that we’ve added to EFS, our smart treasury solution, so that you can reap the benefits of cutting-edge technology without the need to hire your own team of data scientists.