Java IoT Authors: Ed Featherston, Elizabeth White, Liz McMillan, Yeshim Deniz, Pat Romanski

Related Topics: @CloudExpo, Java IoT, Microservices Expo, Linux Containers, Containers Expo Blog, Cloud Security

@CloudExpo: Article

Real-Time Fraud Detection in the Cloud

Using machine learning agent ensembles

This article explores how to detect fraud among online banking customers in real-time by running an ensemble of statistical and machine learning algorithms on a dataset of customer transactions and demographic data. The algorithms, namely Logistic Regression, Self-Organizing Maps and Support Vector Machines, are operationalized using a multi-agent framework for real-time data analysis. This article also explores the cloud environment for real-time analytics by deploying the agent framework in a cloud environment that meets computational demands by letting users' provision virtual machines within managed data centers, freeing them from the worry of acquiring and setting up new hardware and networks.

Real-time decision making is becoming increasingly valuable with the advancement of data collection and analytics techniques. Due to the increase in the speed of processing, the classical data warehousing model is moving toward a real-time model. A platform that enables the rapid development and deployment of applications, reducing the lag between data acquisition and actionable insight has become of paramount importance in the corporate world. Such a system can be used for the classic case of deriving information from data collected in the past and also to have a real-time engine that reacts to events as they occur. Some examples of such applications include:

  • A product company can get real-time feedback for their new releases using data from social media
  • Algorithmic trading by reacting in real times to fluctuations in stock prices
  • Real-time recommendations for food and entertainment based on a customer's location
  • Traffic signal operations based on real-time information of volume of traffic
  • E-commerce websites can detect a customer transaction being authentic or fraudulent in real-time

A cloud-based ecosystem enables users to build an application that detects, in real-time, fraudulent customers based on their demographic information and financial history. Multiple algorithms are utilized to detect fraud and the output is aggregated to improve prediction accuracy.

The dataset used to demonstrate this application comprises of various customer demographic variables and financial information such as age, residential address, office address, income type, income frequency, bankruptcy filing status, etc. The dependent variable (the variable to be predicted) is called "bad", which is a binary variable taking the value 0 (for not fraud) or 1 (for fraud).

Using Cloud for Effective Usage of Resources
A system that allows the development of applications capable of churning out results in real-time has multiple services running in tandem and is highly resource intensive. By deploying the system in the cloud, maintenance and load balancing of the system can be handled efficiently. It will also give the user more time to focus on application development. For the purpose of fraud detection, the active components, for example, include:

  • ActiveMQ
  • Web services
  • PostgreSQL

This approach combines the strengths and synergies of both cloud computing and machine learning technologies, providing a small company or even a startup that is unlikely to have specialized staff and necessary infrastructure for what is a computationally intensive approach, the ability to build a system that make decisions based on historical transactions.

Agent Paradigm
As multiple algorithms are to be run on the same data, a real-time agent paradigm is chosen to run these algorithms. An agent is an autonomous entity that may expect inputs and send outputs after performing a set of instructions. In a real-time system, these agents are wired together with directed connections to form an agency. An agent typically has two behaviors, cyclic and triggered. Cyclic agents, as the name suggests, run continuously in a loop and do not need any input. These are usually the first agents in an agency and are used for streaming data to the agency by connecting to an external real-time data source. A triggered agent runs every time it receives a message from a cyclic agent or another triggered agent. Once it consumes one message, it waits for the next message to arrive.

Figure 1: A simple agency with two agents

In Figure 1, Agent 1 is a cyclic agent while Agent 2 is a triggered agent. Agent 1 finishes its computation and sends a message to Agent 2, which uses the message as an input for further computation.

Feature Selection and Data Treatment
The dataset used for demonstrating fraud detection agency has 250 variables (features) pertaining to the demographic and financial history of the customers. To reduce the number of features, a Random Forest run was conducted on the dataset to obtain variable importance. Next, the top 30 variables were selected based on the variable importance. This reduced dataset was used for running a list of classification algorithms.

Algorithms for Fraud Detection
The fraud detection problem is a binary classification problem for which we have chosen three different algorithms to classify the input data into fraud (1) and not fraud (0). Each algorithm is configured as a triggered agent for our real-time system.

Logistic Regression
This is a probabilistic classification model where the dependent variable (the variable to be predicted) is a binary variable or a categorical variable. In case of binary dependent variables favorable outcomes are represented as 1 and non-favorable outcomes are represented as 0. Logistic regression models the probability of the dependent variable taking the value 0 or 1.

For the fraud detection problem, the dependent variable "bad" is modelled to give probabilities to each customer of being fraud or not. The equation takes multiple variables as input and returns a value between 0 & 1 which is the probability of "bad" being 0. If this value is greater than 0.7, then that customer is classified as not fraud.

Self-Organizing Maps (SOM)
This is an artificial neural network that uses unsupervised learning to represent the data in lower (typically two dimensions) dimensions. This representation of the input data in lower dimensions is called a map. Like most artificial neural networks, SOMs operate in two modes: training and mapping. "Training" builds the map using input examples, while "mapping" automatically classifies a new input vector.

For the fraud detection problem, the input space which is a fifty dimensional space is mapped to a two dimensional lattice of nodes. The training is done using data from the recent past and the new data is mapped using the trained model, which puts it either in the "fraud" cluster or "not - fraud" cluster.

Figure 2: x is an in-put vector in higher dimension, discretized in 2D using wij as the weight matrix
Image Source: http://www.lohninger.com/helpcsuite/kohonen_network_-_background_information.htm

Support Vector Machines (SVM)
This is a supervised learning technique used generally for classifying data. It needs a training dataset where the data is already classified into the required categories. It creates a hyperplane or set of hyperplanes that can be used for classification. The hyperplane is chosen such that it separates the different classes and the margin between the samples in the training set is widest.

For the fraud detection problem, SVM classifies the data points into two classes. The hyperplane is chosen by training the model over the past data. Using the variable "bad", the clusters are labeled as "0" (fraud) and "1" (not fraud). The new data points are classified using the hyperplane obtained while training.

Figure 3: Of the three hyperplanes which segment the data, H2 is the hyperplane which classifies the data accurately

Image Source: http://en.wikipedia.org/wiki/File:Svm_separating_hyperplanes.png

Fraud Detection Agency
A four-tier agency is created to build a workflow process for fraud detection.

Streamer Agent (Tier 1): This agent streams data in real-time to agents in Tier 2. It is the first agent in the agency and its behavior is cyclic. It connects to a real-time data source, pre-processes the data and sends it to the agents in the next layer.

Algorithm Agents (Tier 2): This tier has multiple agents running an ensemble of algorithms with one agent per algorithm. Each agent receives the message from the streamer agent and uses a pre-trained (trained on historical data) model for scoring.

Collator Agent (Tier 3): This agent receives scores from agents in Tier 2 and generates a single score by aggregating the scores. It then converts the score into an appropriate JSON format and sends it to an UI agent for consumption.

User Interface Agent (Tier 4): This agent pushes the messages it receives to a socket server. Any external socket client can be used to consume these messages.

Figure 4: The Fraud detection agency with agents in each layer. The final agent is mapped to a port to which a socket client can connect

Results and Model Validation
The models were trained on 70% of the data and the remaining 30% of the data was streamed to the above agency simulating a real-time data source.

Under-sample: The ratio of number of 0s to the number of 1s in the original dataset for the variable "bad" is 20:1. This would lead to biasing the models towards 0. To overcome this, we sample the training dataset by under-sampling the number of 0s to maintain the ration at 10:1.

The final output of the agency is the classification of the input as fraudulent or not. Since the value for the variable "bad" is already known for this data, it helps us gauge the accuracy of the aggregated model.

Figure 5: Accuracy for detecting fraud ("bad"=1) for different sampling ratio between no.of 0s and no. of 1s in the training dataset

Fraud detection can be improved by running an ensemble of algorithms in parallel and aggregating the predictions in real-time. This entire end-to-end application was designed and deployed in three working days. This shows the power of a system that enables easy deployment of real-time analytics applications. The work flow becomes inherently parallel as these agents run as separate processes communicating with each other. Deploying this in the cloud makes it horizontally scalable owing to effective load balancing and hardware maintenance. It also provides higher data security and makes the system fault tolerant by making processes mobile. This combination of a real-time application development system and a cloud-based computing enables even non-technical teams to rapidly deploy applications.


  • Gravic Inc, "The Evolution of Real-Time Business Intelligence", "http://www.gravic.com/shadowbase/pdf/white-papers/Shadowbase-for-Real-Time-Business-Intelligence.pdf"
  • Bernhard Schlkopf, Alexander J. Smola ( 2002), "Learning with Kernels: Support Vector Machines, Regularization, Optimization, and Beyond (Adaptive Computation and Machine Learning)", MIT Press​
  • Christopher Burges (1998), "A Tutorial on Support Vector Machines for Pattern Recognition", Data Mining and Knowledge Discovery, Kluwer Publishers
  • Kohonen, T. (Sep 1990), "The self-organizing map", Proceedings of IEEE
  • Rokach, L. (2010). "Ensemble based classifiers". Artificial Intelligence Review
  • Robin Genuer, Jean-Michel Poggi, Christine Tuleau-Malot, "Variable Selection using Random Forests", http://robin.genuer.fr/genuer-poggi-tuleau.varselect-rf.preprint.pdf

More Stories By Roger Barga

Roger Barga, PhD, is Group Program Manager for the CloudML team at Microsoft Corporation where his team is building machine learning as a service on the cloud. He is also a lecturer in the Data Science program at the University of Washington. Roger joined Microsoft in 1997 as a Researcher in the Database Group of Microsoft Research (MSR), where he was involved in a number of systems research projects and product incubation efforts, before joining the Cloud and Enterprise Division of Microsoft in 2011.

More Stories By Avinash Joshi

Avinash Joshi is a Senior Research Analyst in the Innovation and Development group of Mu Sigma Business Solutions. He is currently part of a team that works on generating insights from real-time data streams in financial markets. Avinash joined this team in 2011 and has interests ranging from marketing mix modeling to algorithmic trading.

More Stories By Pravin Venugopal

Pravin Venugopal is a Senior Research Analyst in the Innovation and Development group of Mu Sigma Business Solutions. He is currently part of a team that is developing a low latency platform for algorithmic trading. Pravin received his Masters degree in Computer Science and has been a part of Mu Sigma since 2012. His interests include analyzing real-time financial data streams and algorithmic trading.

Comments (1)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

@ThingsExpo Stories
One of biggest questions about Big Data is “How do we harness all that information for business use quickly and effectively?” Geographic Information Systems (GIS) or spatial technology is about more than making maps, but adding critical context and meaning to data of all types, coming from all different channels – even sensors. In his session at @ThingsExpo, William (Bill) Meehan, director of utility solutions for Esri, will take a closer look at the current state of spatial technology and ar...
According to Forrester Research, every business will become either a digital predator or digital prey by 2020. To avoid demise, organizations must rapidly create new sources of value in their end-to-end customer experiences. True digital predators also must break down information and process silos and extend digital transformation initiatives to empower employees with the digital resources needed to win, serve, and retain customers.
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, wh...
Complete Internet of Things (IoT) embedded device security is not just about the device but involves the entire product’s identity, data and control integrity, and services traversing the cloud. A device can no longer be looked at as an island; it is a part of a system. In fact, given the cross-domain interactions enabled by IoT it could be a part of many systems. Also, depending on where the device is deployed, for example, in the office building versus a factory floor or oil field, security ha...
Businesses are struggling to manage the information flow and interactions between all of these new devices and things jumping on their network, and the apps and IT systems they control. The data businesses gather is only helpful if they can do something with it. In his session at @ThingsExpo, Chris Witeck, Principal Technology Strategist at Citrix, will discuss how different the impact of IoT will be for large businesses, expanding how IoT will allow large organizations to make their legacy ap...
19th Cloud Expo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Meanwhile, 94% of enterpri...
Ask someone to architect an Internet of Things (IoT) solution and you are guaranteed to see a reference to the cloud. This would lead you to believe that IoT requires the cloud to exist. However, there are many IoT use cases where the cloud is not feasible or desirable. In his session at @ThingsExpo, Dave McCarthy, Director of Products at Bsquare Corporation, will discuss the strategies that exist to extend intelligence directly to IoT devices and sensors, freeing them from the constraints of ...
In this strange new world where more and more power is drawn from business technology, companies are effectively straddling two paths on the road to innovation and transformation into digital enterprises. The first path is the heritage trail – with “legacy” technology forming the background. Here, extant technologies are transformed by core IT teams to provide more API-driven approaches. Legacy systems can restrict companies that are transitioning into digital enterprises. To truly become a lea...
24Notion is full-service global creative digital marketing, technology and lifestyle agency that combines strategic ideas with customized tactical execution. With a broad understand of the art of traditional marketing, new media, communications and social influence, 24Notion uniquely understands how to connect your brand strategy with the right consumer. 24Notion ranked #12 on Corporate Social Responsibility - Book of List.
Why do your mobile transformations need to happen today? Mobile is the strategy that enterprise transformation centers on to drive customer engagement. In his general session at @ThingsExpo, Roger Woods, Director, Mobile Product & Strategy – Adobe Marketing Cloud, covered key IoT and mobile trends that are forcing mobile transformation, key components of a solid mobile strategy and explored how brands are effectively driving mobile change throughout the enterprise.
SYS-CON Events announced today that CDS Global Cloud, an Infrastructure as a Service provider, will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. CDS Global Cloud is an IaaS (Infrastructure as a Service) provider specializing in solutions for e-commerce, internet gaming, online education and other internet applications. With a growing number of data centers and network points around the world, ...
SYS-CON Events announced today that LeaseWeb USA, a cloud Infrastructure-as-a-Service (IaaS) provider, will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. LeaseWeb is one of the world's largest hosting brands. The company helps customers define, develop and deploy IT infrastructure tailored to their exact business needs, by combining various kinds cloud solutions.
Technology vendors and analysts are eager to paint a rosy picture of how wonderful IoT is and why your deployment will be great with the use of their products and services. While it is easy to showcase successful IoT solutions, identifying IoT systems that missed the mark or failed can often provide more in the way of key lessons learned. In his session at @ThingsExpo, Peter Vanderminden, Principal Industry Analyst for IoT & Digital Supply Chain to Flatiron Strategies, will focus on how IoT de...
Cloud computing is being adopted in one form or another by 94% of enterprises today. Tens of billions of new devices are being connected to The Internet of Things. And Big Data is driving this bus. An exponential increase is expected in the amount of information being processed, managed, analyzed, and acted upon by enterprise IT. This amazing is not part of some distant future - it is happening today. One report shows a 650% increase in enterprise data by 2020. Other estimates are even higher....
WebRTC is bringing significant change to the communications landscape that will bridge the worlds of web and telephony, making the Internet the new standard for communications. Cloud9 took the road less traveled and used WebRTC to create a downloadable enterprise-grade communications platform that is changing the communication dynamic in the financial sector. In his session at @ThingsExpo, Leo Papadopoulos, CTO of Cloud9, discussed the importance of WebRTC and how it enables companies to focus...
There is little doubt that Big Data solutions will have an increasing role in the Enterprise IT mainstream over time. Big Data at Cloud Expo - to be held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA - has announced its Call for Papers is open. Cloud computing is being adopted in one form or another by 94% of enterprises today. Tens of billions of new devices are being connected to The Internet of Things. And Big Data is driving this bus. An exponential increase is...
The Internet of Things can drive efficiency for airlines and airports. In their session at @ThingsExpo, Shyam Varan Nath, Principal Architect with GE, and Sudip Majumder, senior director of development at Oracle, will discuss the technical details of the connected airline baggage and related social media solutions. These IoT applications will enhance travelers' journey experience and drive efficiency for the airlines and the airports. The session will include a working demo and a technical d...
Big Data has been changing the world. IoT fuels the further transformation recently. How are Big Data and IoT related? In his session at @BigDataExpo, Tony Shan, a renowned visionary and thought leader, will explore the interplay of Big Data and IoT. He will anatomize Big Data and IoT separately in terms of what, which, why, where, when, who, how and how much. He will then analyze the relationship between IoT and Big Data, specifically the drilldown of how the 4Vs of Big Data (Volume, Variety,...
For basic one-to-one voice or video calling solutions, WebRTC has proven to be a very powerful technology. Although WebRTC’s core functionality is to provide secure, real-time p2p media streaming, leveraging native platform features and server-side components brings up new communication capabilities for web and native mobile applications, allowing for advanced multi-user use cases such as video broadcasting, conferencing, and media recording.
Adobe is changing the world though digital experiences. Adobe helps customers develop and deliver high-impact experiences that differentiate brands, build loyalty, and drive revenue across every screen, including smartphones, computers, tablets and TVs. Adobe content solutions are used daily by millions of companies worldwide-from publishers and broadcasters, to enterprises, marketing agencies and household-name brands. Building on its established design leadership, Adobe enables customers not o...