# Solving Financial Fraud Detection with Machine Learning Methods

9 min read## How industry Solving Financial Fraud Detection with Machine Learning Methods

For decades, financial organizations used rule-based monitoring systems for fraud detection.

These legacy solutions were deployed in SQL or C/C++. They were attempts of the engineers to transfer the knowledge of domain experts into sequel queries, which might typically find yourself being long, convoluted, and very brittle.

And whenever they tried to vary parts of those fraud detection systems later, to update a threshold or something, it led to the breaking of the whole codebase.

This prevented banks from fighting fraud effectively – the criminals would just come up with new ways around alert triggers in their weak, rule-based platforms.

So now many financial firms have abandoned their legacy tools to undertake and solve fraud detection with new-age machine learning solutions, and more still are getting to imitate within the future.

ML algorithms can process many data objects quickly and link instances from seemingly unrelated datasets to detect suspicious patterns. They’re one among the sole tools left which will help banks and FinTechs continue with new defrauding schemes, which are growing increasingly sophisticated.

But it’d be unclear for somebody who’s not a knowledge scientist which algorithm to choose to assist their company to identify illicit transactions. during this post, we’ll describe a couple of popular choices.

Financial Fraud Detection – Machine Learning Techniques

Both supervised and unsupervised methods of varied complexity are applied by banks to identify anomalies in financial data. Let’s start with the supervised ones.

## Supervised Models utilized in Fraud Detection Software

image by perfectilal.com

Random Forest. the tactic leverages a group of randomized decision trees and averages across their predictions to make outputs. it’s multiple trees producing different values and this prevents the algorithm from overfitting to training datasets (something standard decision tree algorithms tend to do) and makes it more robust to noise.

Numerous comparative studies are published that prove RF’s effectiveness in fraud detection relative to other models. The results of this research show that an RF-based model outperforms a support vector machine and even a neural network in terms of AP, AUC, and PrecisonRank metrics (all of the models made predictions on a true transaction data from a Belgian payment provider.)

This paper (by Van Vlasselaer et al.,) indicates that random forests can have stronger predictive power than neural nets and rectilinear regression algorithms: the experiments on an in-depth real-transaction dataset (3+ million transactions), show that an RF model reaches better AOC than the opposite two.

Besides that, there’s also a publication saying that RF is superior to k-nearest neighbors and in anomaly detection.

K-nearest neighbors (KNN). The algorithm predicts which class an unseen instance belongs to supported K (a predefined number) most similar data objects. The similarity is usually defined by Euclidean distance but, for specific settings, Chebyshev and Hamming distance measures are often applied too, when that’s more suitable.

So, after being given an unseen observation, KNN runs through the whole annotated dataset and computes the similarity between the new data object and everyone other data object in it. When an instance is analogous with objects in several categories, the algorithm picks the category that has the foremost votes. If K=10, as an example, and therefore the object has 7 nearest neighbors in category a , and three nearest neighbors in category b – it’ll be assigned to a.

Though quite sensitive to noise, KNN performs well on real financial transaction data. Over the years, studies have demonstrated that KNNs can have a lower error rate than Decision Trees and Logistic Regression models, which they will beat Support Vector Machines in terms of fraud detection rates (sensitivity) also as Random Forests in balance classification rate.

Logistic Regression. An easily explainable model that permits us to predict the probability of a categorical response supported one or a couple of predictor variables. LR is quick to implement, which could make it appear to be a beautiful option. However, the empirical evidence shows it performs poorly when handling non-linear data which it tends to overfit to training datasets.

This paper, for instance, describes how neural nets have a transparent edge over LR-based models in solving Mastercard fraud detection problems. Similarly, this comparative research states LR can’t provide predictions as accurate as those produced by a deep learning model and Gradient Boosted Tree (for this experiment, the researchers had all three models making predictions on a dataset containing about 80 million transactions with 69 attributes.)

Support Vector Machine. SVMs, advanced yet simple in implementation, derive optimal hyperplanes that maximize a margin between classes. They utilize kernel functions to project input file onto high-dimensional feature spaces, wherein it’s easier to separate instances linearly. This makes SVMs particularly effective in terms of non-linear classification problems like financial fraud detection.

In this study, the performance of an SVM in investigating a time-varying fraud problem is compared thereto of a neural net. The researchers write that though the models show similar results (in terms of accuracy) during training, the neural net tends to overfit to training datasets more which makes the SVMs a superior solution within the end of the day.

Another research (by Lu & Ju) says that an imbalance class weighted SVM-based fraud detection model is more suitable for working with real-world Mastercard transactional data (which is an imbalance in nature) and shows higher accuracy rates within the fraud detection problem than Naive Bayes, Decision Tree, and Back Propagation Neural Network classifiers.

It should be noted though that while SVMs work great in complicated domains that have distinct margins of separation, their performance on large data sets is usually average. If there’s noise in data, it can hamper SVM’s accuracy tremendously, so when there are many overlapping classes (and we’d like to count independent evidence) other supervised algorithms would probably make a far better choice.

Long STM. LSTM may be a sort of Recurrent Neural specification that’s designed specifically to find out long-range dependencies; it tackles the vanishing error problem (which RNNs are particularly susceptible to thanks to using an equivalent processing units on every layer) by applying constant error carousels to enforce a continuing error flow within cells. The model’s key property is that it’s multiplicative gates that learn to make a decision when to grant access to cells and which parts of input to ignore.

LSTMs are difficult to integrate into real-world applications at now , in order that they haven’t yet become a mainstream tool for financial fraud detection among banks. However, there are already scientific papers published that formulate Mastercard fraud detection as a sequence classification task that LSTMs, thanks to their unique properties, are an ideal solution. This publication, for instance , suggests that in comparison to a random forest classifier, an LSTM can increase fraud detection accuracy even on offline transactions (the situations where card-holders are present physically at the bank).

Also, consistent with Nitin Sharma , Paypal has achieved remarkable leads to classifying clients’ behavior using the architecture. instead of concentrating on researching the transactions alone (which gives quite limited amount of information), the payment provider has decided to review, through LSTMs, the long sequences of event-based user behavior to ascertain the larger picture.

Instead of manually engineering features and hardcoding timelines, the corporate uses raw event data and applies LSTMs to find out temporal representations. this permits PayPal to model the matter at the event level and analyze the actions which may cause a fraudulent transaction (they check out clues like whether the user has changed their home, shipping, or billing address, or whether or not they replaced their contact details, etc.)

This switch from hand-coded features to using raw event data and LSTMs has given PayPal a more granular perspective on the fraud detection problem, Nitin says, also as increased their performance in anomaly detection by 7-10%.

## Unsupervised Algorithms For Fraud Detection in Banking

K-means. one among the oldest, most well-known unsupervised techniques K-means remains widely used. the tactic boils right down to partitioning instances of unlabeled data into variety (K) of clusters during a way that minimizes the square distance between the info objects and centroid in each cluster.

The basic flow of the algorithm goes like this: we pick K (the number of clusters the algorithm are going to be trying to produce) and therefore the model chooses, at random, K of points to be centers of those clusters.

Then, each centroid claims all the info points closest thereto and after the results of the primary attempt at clustering are obtained, the algorithm recomputes the centroids by averaging the cluster points. It then keeps looping through these two actions until the convergence is reached.

The model’s liability is that it’s ultra-sensitive to the initial center points and thus susceptible to outliers. Also, the knowledge of somebody who has deep financial expertise would be needed to select the optimal value for K.

That being said, there are several studies describing the successful application of k-means to the anomaly identification task. Here, researchers generated an in-depth dataset consisting of mastercard numbers, merchant category IDs, transaction dates, countries, and amounts, and had the model attempt to divide the info points into four clusters: low, high, risky, high risk.

The results were encouraging, the researchers say, as fraudulent activities were spotted most of the time and there was but a small false-positive rate.

There also are more complex approaches involving architecture, like this one. The framework proposed within the paper combines K-means with a Hidden Markov Model to tackle criminal activity detection. The prior is applied to the historical data from a financial services provider to categorize customers supported what proportion money they typically spend (the categories are: low, medium, and high transactions) then the latter model generates outputs that are probabilities of transactions being fraudulent.

Self-organizing Map (SOM). This unsupervised deep learning method is employed for the clustering of high-dimensional data. It tries to project data down (the data doesn’t get to be linear) to one- or two-dimensional surfaces while capturing the maximum amount information about the dataset’s inner structure as possible.

Here’s how it works: we first find a neuron within the network that has similar weights to the input feature values (the input vector is sampled at random) then we calculate the neighborhood of that neuron.

After we’ve found the simplest matching unit, we update the weights of the neuron and therefore the neurons closest thereto to form them more just like the input vector (the closer the neurons are, the more their weights are modified, the farther away, the less.) We repeat this by sampling a replacement input vector whenever to travel through the whole dataset.

The neurons that represent input instances act similarly to centroids in K-Means, which is why some call SOM a constrained K-means.

Due to its inherent capability to scale back dimensionality, the algorithm is uniquely poised to affect high-dimensional inputs like transaction data. When applied to the detection of abnormal transactional activities, the model first groups data into categories of “fraudulent” and “legitimate” through self-organization (which is that the iterative updating of neurons’ weights to capture the simplest possible input representations) then, after being given a replacement instance, assigns it to at least one of the groups supported how similar the input is to genuine or fraudulent transactions.

An interesting SOM-based method for identifying fraud is proposed here. The researchers visualize multidimensional data (the matrices that store records that reflect sequential activities of users) through a self-organizing map then apply a threshold-type system for fraud detection. the tactic shows clear benefits of SOM produced visualization for transaction classification.

Another noteworthy work (by Agaskar et al.,) proposes an unsupervised model that identifies fraudulent transactions supported customers’ previous transaction details i.e location and amount information. The clusters are obtained through a SOM, then association rules are applied additionally to every cluster to avoid receiving unclear decision boundaries.

## To conclude

There’s been a spread of machine learning-based methods proposed, both supervised and unsupervised, to tackle the difficulty of fraud detection. The supervised approaches believe explicit transaction labels i.e. machines got to be shown, repeatedly, what genuine transactions appear as if during training to be ready to distinguish the fraudulent ones later.

In contrast, unsupervised models capture normal data distribution in unlabeled data sets when they’re being trained. And then, when given a replacement data instance, they struggle to work out whether the sample is legitimate or abnormal (suspicious) supported the patterns and structures they’ve derived.

In this article, we’ve reviewed the entire of seven ML models, but there’s no telling which method will fit your processes and your particular setting best, without doing research and experimentation. We’d need to assess what data and features you’ve got readily available to work out which model can assist you detect fraud efficiently.

So, if you’re a financial firm looking to implement machine learning to scale back losses caused by mastercard misuse, unauthorized access to your payment systems, and other sorts of fraud – reach bent our expert immediately for a free consultation.