## Machine Learning 101: An Engineer’s Perspective

In 2019, FloQast released a product called AutoRec, which automates the account reconciliation process, saving accountants hours or days they would otherwise spend manually sifting through transactions each month to identify true exceptions or reconciling items. This is often achieved by comparing two data sets, such as the general ledger against the bank statement.

In order to accomplish that task, we developed a matching engine that used numerous algorithms to comb through the data and automatically match transactions on behalf of the user. But, as the number of AutoRec users increased, so did the number of variations in how matches are made for different clients. This led to a growing number of configuration options and increased complexity in the engine, as well as a growing number of custom configurations that had to be maintained for individual clients. We needed a more scalable solution!

So, we asked ourselves, can we use machine learning here? At the time, I was new to the engine team and had no experience with machine learning. I had more questions than answers. Even today, there are a number of questions about machine learning (and quite a few misnomers, as well) and its capabilities. So, I’ll attempt to help you build a basic intuition for what machine learning is and how it works.

### A (Very) Brief Introduction to Machine Learning

The term “machine learning” has become immensely popular in the last few years, but it’s not always clear what exactly is being “learned” and how. And while this is a vast field of study with many different techniques, algorithms, and applications, we’ll use a simple example to illustrate the core concept which is at the heart of machine learning.

Let’s begin with how we humans may learn from data that we’re presented with. Suppose you were given the following data and asked to figure out what the values for A and B might be:

(A x 2) + ( B x 10) = 30

(A x 3) + ( B x 20) = 55

(A x 5) + ( B x 30) = 85

You probably correctly arrived at the conclusion that A = 5 and B = 2 [Editor’s Note: It was my understanding that there would be no math…]. Now, think about the process that took place in your mind as you were solving the problem. It may have looked something like this:

1. Take a guess at initial values for A and B
2. Calculate the result for each line using the selected values
3. Check the results against the given answers
4. Adjust values for A and B and repeat until the results match the answers (as best as possible)

We have just described a training loop! The same process is used in machine learning, where the goal is to learn the optimal values for A and B (also known as weights) based on the given answers. And since we are given the answers to check against, this is called supervised learning.

In this example, we have two input features, the values [2, 3, 5] and [10, 20, 30], that correspond to the weights A and B, respectively, but in reality, there could be hundreds or thousands of features that represent different pieces of data. The features are the data points that describe the problem you’re trying to solve. So, if you were trying to predict housing prices, your features might include things like square footage, number of bedrooms, number of bathrooms, etc…

Of course, that begs the question: How exactly does the machine know how to mimic the above process of guessing and adjusting the weights?

As it turns out, there are algorithms that know just how to do that! In fact, machine learning is essentially a set of established algorithms that make learning possible. One such algorithm is called gradient descent. The initial weights may start with zeros or random values. The more interesting part is how it adjusts the weights to get closer to the correct answers by minimizing the cost (the difference between the current results and the given answers) with each iteration. It does so using formulas based on derivatives to determine whether each weight should be increased or decreased. Now that we learned the optimal weights based on the given input data (also known as training data), we have a model (Read: Set of weights) that can be used to predict the output for new data for which we don’t have the answers.

You may also have a binary classification problem in which the training answers are either 1 (yes) or 0 (no) and the model will be trained to predict a value (also known as a probability) between 0 and 1, in which case you might consider a probability of 0.5 or higher to be a yes prediction.

### Back to Our Transaction Matching Problem

If we step back and look at what machine learning is doing, it’s learning the relative importance (weight) of the individual features in relation to the output being predicted.

So for the matching engine, we realized that if we could come up with a way (i.e. features) to represent what a matching pair of transactions looks like, we can use machine learning to train a model that can predict if we have a match. And better yet: We don’t have to use custom configuration to account for the variations across FloQast users because the model can learn these variations all on its own, and we end up with virtually a zero-configuration matching engine that doesn’t have to increase in complexity as more clients use it.

It also makes life easier for our clients and our support team because they no longer have to look at the data and try to come up with their own set of matching rules, which must be designed and maintained by the user, to produce the best matches. ###### Ramy Georgy

Ramy is a Senior Software Engineer at FloQast. He enjoys hiking, tea, and smoked BBQ!

Back to Blog
{"ft_lang_label":"__label__en","ft_lang_prob":0.9613458,"math_prob":0.9274111,"size":5585,"snap":"2023-40-2023-50","text_gpt3_token_len":1182,"char_repetition_ratio":0.11843756,"word_repetition_ratio":0.004048583,"special_character_ratio":0.21396598,"punctuation_ratio":0.08410351,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9645904,"pos_list":[0,1,2,3,4,5,6,7,8,9,10],"im_url_duplicate_count":[null,1,null,1,null,1,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-28T02:13:12Z\",\"WARC-Record-ID\":\"<urn:uuid:fe472666-9fda-46dd-b23e-1541a987667e>\",\"Content-Length\":\"206587\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:d8b01dd6-c3e8-4820-b16d-2764f71156b1>\",\"WARC-Concurrent-To\":\"<urn:uuid:789102da-3671-421f-9912-6aa55250f11f>\",\"WARC-IP-Address\":\"141.193.213.20\",\"WARC-Target-URI\":\"https://floqast.com/engineering-blog/post/machine-learning-101-an-engineers-perspective/\",\"WARC-Payload-Digest\":\"sha1:G7W3UD32P46ZJQ5R2RW35626PY6PNU3D\",\"WARC-Block-Digest\":\"sha1:Z5VLHPDGMQDRMYIR4U6IISOWLKLRDFQQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510334.9_warc_CC-MAIN-20230927235044-20230928025044-00786.warc.gz\"}"}