Final
Final
Submitted by
of
BACHELOR OF TECHNOLOGY
in
JUNE 2023
`
DECLARATION
We hereby declare that the work described in this project, entitled ‘CREDIT CARD
FRAUD DETECTION USING ADABOOST AND MAJORITY VOTING’ which
is being submitted by us in partial fulfilment for the award of Bachelor of Technology
in Computer Science and Engineering to AURORA’S TECHNOLOGICAL AND
RESEARCH INSTITUTE is the result of investigation carried by us under the
guidance of Mr. Rohit Kumar, Assistant Professor, CSE.
The work is original and has not been submitted for any degree of this or any other
university.
Place: Hyderabad
Date:
ii
`
CERTIFICATE
Dept. of CSE
EXTERNAL EXAMINER
iii
`
ACKNOWLEDGMENT
This work has been done during the project period and it was a very good
opportunity to put theoretical knowledge into planned exercise with an aim to solve a
real time problem and also to develop confidence to face various practical situations.
We would also like to express our gratitude to Mr. Srikanth Jatla, Director,
Aurora’s Technological and Research Institute for providing us with a congenial
atmosphere and encouragement.
iv
`
ABSTRACT
Credit card fraud is a serious problem in financial services. Billions of dollars are lost
due to credit card fraud every year. There is a lack of research studies on analysing real-
world credit card data owing to confidentiality issues. In this paper, machine learning
algorithms are used to detect credit card fraud. Standard models are firstly used. Then,
hybrid methods which use AdaBoost and majority voting methods are applied. To
evaluate the model efficacy, a publicly available credit card data set is used. Then, a
real-world credit card data set from a financial institution is analysed. In addition, noise
is added to the data samples to further assess the robustness of the algorithms. The
experimental results positively indicate that the majority voting method achieves good
accuracy rates in detecting fraud cases in credit cards.
v
`
TABLE OF CONETNTS
vi
`
vii
`
LIST OF FIGURES
viii
`
ix
`
LIST OF ABBREVATIONS
API - Application Program Interface
HTML - Hyper Text Markup Language
IDE - Integrated Development Environment
JDBC - Java Database Connectivity
JIT - Just In Time
JSP - Java Server Pages
JVM - Java Virtual Machine
LAN - Local Area Network
ODBC - Open Database Connectivity
OSN - Online Server Name
SGML - Standard Generalised Markup Language
SM - Social Media
SQL - Structured Query Language
UML - Unified Modelling Language
x
`
CHAPTER 1
INTRODUCTION
Fraud is a wrongful or criminal deception aimed to bring financial or personal
gain. In avoiding loss from fraud, two mechanisms can be used: fraud prevention and
fraud detection. Fraud prevention is a proactive method, where it stops fraud from
happening in the first place. On the other hand, fraud detection is needed when a
fraudulent transaction is attempted by a fraudster. Credit card fraud is concerned with
the illegal use of credit card information for purchases. Credit card transactions can be
accomplished either physically or digitally. In physical transactions, the credit card is
involved during the transactions. In digital transactions, this can happen over the
telephone or the internet. Cardholders typically provide the card number, expiry date,
and card verification number through telephone or website. With the rise of e-
commerce in the past decade, the use of credit cards has increased dramatically. The
number of credit card transactions in 2011 in Malaysia were at about 320 million, and
increased in 2015 to about 360 million. Along with the rise of credit card usage, the
number of fraud cases have been constantly increased. While numerous authorization
techniques have been in place, credit card fraud cases have not hindered effectively.
Fraudsters favour the internet as their identity and location are hidden. The rise in credit
card fraud has a big impact on the financial industry.
The global credit card fraud in 2015 reached to a staggering USD $21.84 billion.
Loss from credit card fraud affects the merchants, where they bear all costs, including
card issuer fees, charges, and administrative charges. Since the merchants need to bear
the loss, some goods are priced higher, or discounts and incentives are reduced.
Therefore, it is imperative to reduce the loss, and an effective fraud detection system to
reduce or eliminate fraud cases is important. There have been various studies on credit
card fraud detection. Machine learning and related methods are most commonly used,
which include artificial neural networks, rule-induction techniques, decision trees,
logistic regression, and support vector machines. These methods are used either
standalone or by combining several methods together to form hybrid models. IEEE In
this paper, a total of twelve machine learning algorithms are used for detecting credit
card fraud. The algorithms range from standard neural networks to deep learning
1
`
models. They are evaluated using both benchmark and real-world credit card data sets.
In addition, the AdaBoost and majority voting methods are applied for forming hybrid
models. To further evaluate the robustness and reliability of the models, noise is added
to the real-world data set. The key contribution of this paper is the evaluation of a
variety of machine learning models with a real-world credit card data set for fraud
detection. While other researchers have used various methods on publicly available
data sets, the data set used in this paper are extracted from actual credit card transaction
information over three months.
Payment cards are easy to use because you only need to transmit a few simple
numbers to the bank in order to identify your account and authorize the transaction.
This simplicity makes them vulnerable as well. It’s very hard to practice rigorous data
security on a few simple numbers that must be shared with the parties you’re transacting
with.
In the card-present space, EMV chips have gone a long way towards reducing
in-person fraud. These chips tokenize account numbers, making them less vulnerable
to data theft, and cannot be counterfeited as easily as magnetic stripe cards.
2
`
Credit card fraud costs the global economy more than $24 billion per year, and
the numbers keep going up. Smaller merchants suffer the most from the impact of fraud,
and that’s why it’s so important to have tools and practices in place to detect fraud in
its early stages.
Mostly, AdaBoost uses decision stamps. But we can use any machine learning
algorithm as base learner if it accepts weight on training data set. We can use
AdaBoost algorithm in machine learning for both classification and regression
problems.
Let us consider the example of the image mentioned above. In order to build
an AdaBoost classifier, consider that as a first base classifier a Decision Tree
algorithm is trained to make predictions on our training data. Applying the following
methodology of AdaBoost, the weight of the misclassified training instances is
increased. Then the second classifier is trained and the updated weights are
acknowledged. It repeats the procedure over and over again.
At the end of every model prediction, we end up boosting the weights of the
misclassified instances so that the next model does a better job on them, and so on.
3
`
4
`
Protective approaches are derived by applying specific limits, which means that
a sample is assigned only if the frequency of assignments to a class is higher than a
selected threshold. For example, “intermediate” and “strict” majority voting criteria
classify a sample if the agreement of predictions is higher than or equal to 75% and
100%, respectively. The strict majority voting represents the case of full prediction
agreement of all the considered models.
Imagine to have five analytical data blocks, each one associated with a specific
(and independent) classification model, which can assign samples to class A or class B.
Note that samples can also be nonassigned (na); for example, the analytical
measurements associated with the model P5 were not available for the sample S4 or the
sample S4 was an outlier in the analytical chemical space of P5 and thus no prediction
was provided. The agreement of predictions is evaluated by the class frequency, that is,
the ratio of the number of predictions in a specific class over the number of available
predictions. Finally, majority voting rules assign a sample to the class associated with
the highest frequency of predictions, unless the specific restrictions on the percentage
of class agreement are not fulfilled.
5
`
CHAPTER 2
LITERATURE SURVEY.
2.1 Title: Machine Learning For Credit Card Fraud Detection System
Authors: Lakshmi S V S S1, Selvani Deepthi Kavila2
The rapid growth in E-Commerce industry has lead to an exponential increase
in the use of credit cards for online purchases and consequently they has been surge in
the fraud related to it. In recent years, for banks has become very difficult for detecting
the fraud in credit card system. Machine learning plays a vital role for detecting the
credit card fraud in the transactions. For predicting these transactions banks make use
of various machine learning methodologies, past data has been collected and new
features are been used for enhancing the predictive power. The performance of fraud
detecting in credit card transactions is greatly affected by the sampling approach on
data-set, selection of variables and detection techniques used.
This paper investigates the performance of logistic regression, decision tree and
random forest for credit card fraud detection. Dataset of credit card transactions is
collected from Kaggle and it contains a total of 2,84,808 credit card transactions of a
European bank data set. It considers fraud transactions as the “positive class” and
genuine ones as the “negative class”. The data set is highly imbalanced, it has about
0.172% of fraud transactions and the rest are genuine transactions. The author has been
done oversampling to balance the data set, which resulted in 60% of fraud transactions
and 40% genuine ones. The three techniques are applied for the dataset and work is
implemented in R language. The performance of the techniques is evaluated for
different variables based on sensitivity, specificity, accuracy and error rate. The result
shows of accuracy for logistic regression, Decision tree and random forest classifier are
90.0, 94.3, 95.5 respectively. The comparative results show that the Random Forest
performs better than the logistic regression and decision tree techniques.
6
`
2.3 Title: Credit Card Fraud Detection Using Hidden Markov Model
Authors: Abhinav Srivastava; Amlan Kundu; Shamik Sural; Arun Majumdar
The Internet has taken its place beside the telephone and the television as an
important part of people's lives. Consumers rely on the Internet to shop, bank and invest
online. Most online shoppers use credit cards to pay for their purchases. As credit card
becomes the most popular mode of payment, cases of fraud associated with it are also
increasing. In this paper, we model the sequence of operations in credit card transaction
processing using a Hidden Markov Model (HMM) and show how it can be used for the
detection of frauds. An HMM is trained with normal behaviour of cardholder. If an
incoming credit card transaction is not accepted by the HMM with sufficiently high
probability, it is considered to be fraudulent. We present detailed experimental results
to show the effectiveness of our approach.
7
`
8
`
2.6 Title: A Novel Model For Credit Card Fraud Detection Using
Artificial Immune Systems
Authors: Neda Soltani Halvaiee, Mohammad Kazem Akbari
The amount of online transactions is growing these days to a large number. A
big portion of these transactions contains credit card transactions. The growth of online
fraud, on the other hand, is notable, which is generally a result of ease of access to edge
technology for everyone. There has been research done on many models and methods
for credit card fraud prevention and detection. Artificial Immune Systems is one of
them. However, organizations need accuracy along with speed in the fraud detection
systems, which is not completely gained yet. In this paper we address credit card fraud
detection using Artificial Immune Systems (AIS), and introduce a new model called
AIS-based Fraud Detection Model (AFDM). We will use an immune system inspired
algorithm (AIRS) and improve it for fraud detection. We increase the accuracy up to
25%, reduce the cost up to 85%, and decrease system response time up to 40%
compared to the base algorithm.
We propose a novel approach for credit card fraud detection, which combines
evidences from current as well as past behaviour. The fraud detection system (FDS)
consists of four components, namely, rule-based filter, Dempster–Shafer adder,
transaction history database and Bayesian learner. In the rule-based component, we
determine the suspicion level of each incoming transaction based on the extent of its
deviation from good pattern. Dempster–Shafer’s theory is used to combine multiple
such evidences and an initial belief is computed. The transaction is classified as normal,
abnormal or suspicious depending on this initial belief. Once a transaction is found to
be suspicious, belief is further strengthened or weakened according to its similarity with
fraudulent or genuine transaction history using Bayesian learning. Extensive simulation
with stochastic models shows that fusion of different evidences has a very high positive
impact on the performance of a credit card fraud detection system as compared to other
methods.
9
`
10
`
2.10.1 Disadvantages
There is no Majority Voting technique for credit card fraud detection.
There is no Machine Learning Techniques in the existing system.
11
`
2.11.1 Advantages
The system is very fast due to AdaBoost Technique.
Effective Majority Voting techniques
12
`
CHAPTER 3
The browser specific components are designed by using the HTML standards,
and the dynamism of the designed by concentrating on the constructs of the Java Server
Pages.
13
`
Java byte codes as the machine code instructions for the Java Virtual Machine
(Java VM). Every Java interpreter, whether it’s a development tool or a Web browser
that can run applets, is an implementation of the Java VM. Java byte codes help make
“write once, run anywhere” possible. You can compile your program into byte codes
on any platform that has a Java compiler. The byte codes can then be run on any
implementation of the Java VM. That means that as long as a computer has a Java VM,
the same program written in the Java programming language can run on Windows 2000,
a Solaris workstation, or on an iMac.
14
`
Initially the language was called as “oak” but it was renamed as “Java” in 1995.
The primary motivation of this language was the need for a platform-independent (i.e.,
architecture neutral) language that could be used to create software to be embedded in
various consumer electronic devices.
Java is a programmer’s language.
Java is cohesive and consistent.
Except for those constraints imposed by the Internet environment, Java gives the
programmer, full control.
Finally, Java is to Internet programming where C was to system programming.
Applets
An Applet is an application designed to be transmitted over the Internet and
executed by a Java –compatible web browser. An applet is actually a tiny Java program,
dynamically downloaded across the network, just like an image. But the difference is,
it is an intelligent program, not just a media file. It can react to the user input and
dynamically change.
15
`
When we use a Java-compatible Web browser, you can safely download Java
applets without fear of virus infection or malicious intent.
Portability
For programs to be dynamically downloaded to all the various types of
platforms connected to the Internet, some means of generating portable executable code
is needed. As you will see, the same mechanism that helps ensure security also helps
create portability. Indeed, Java’s solution to these two problems is both elegant and
efficient.
Translating a Java program into byte code helps makes it much easier to run a
program in a wide variety of environments. The reason is, once the run-time package
exists for a given system, any Java program can run on it.
16
`
Overall Description
Java programming uses to produce byte codes and executes them. The first box
indicates that the Java source code is located in a. Java file that is processed with a Java
compiler called javac. The Java compiler produces a file called a. class file, which
contains the byte code. The. Class file is then loaded across the network or loaded
locally on your machine into the execution environment is the Java virtual machine,
which interprets and executes the byte code.
17
`
Java Architecture
Java architecture provides a portable, robust, high performing environment for
development. Java provides portability by compiling the byte codes for the Java Virtual
Machine, which is then interpreted on each platform by the run-time environment. Java
is a dynamic system, able to load code when needed from a machine in the same room
or across the planet.
Compilation of code
When you compile the code, the Java compiler creates machine code (called
byte code) for a hypothetical machine called Java Virtual Machine (JVM). The JVM is
supposed to execute the byte code. The JVM is created for overcoming the issue of
portability. The code is written and compiled for one machine and interpreted on all
machines. This machine is called Java Virtual Machine.
Java
PC Compiler Java Interpreter
Source
(PC)
Code Byte code
Macintosh Java
………..
Compiler Interpreter
………..
(Macintosh)
(Platform
SPARC
Java
indepen
Compiler Interpreter
(Sparc)
During run-time the Java interpreter tricks the byte code file into thinking that
it is running on a Java Virtual Machine. In reality this could be a Intel Pentium Windows
95 or Sun SARC station running Solaris or Apple Macintosh running system and all
could receive code from any computer through Internet and run the Applets.
18
`
Simple
Java was designed to be easy for the Professional programmer to learn and to
use effectively. If you are an experienced C++ programmer, learning Java will be even
easier. Because Java inherits the C/C++ syntax and many of the object oriented features
of C++. Most of the confusing concepts from C++ are either left out of Java or
implemented in a cleaner, more approachable manner. In Java there are a small number
of clearly defined ways to accomplish a given task.
Object-Oriented
Java was not designed to be source-code compatible with any other language.
This allowed the Java team the freedom to design with a blank slate. One outcome of
this was a clean usable, pragmatic approach to objects. The object model in Java is
simple and easy to extend, while simple types, such as integers, are kept as high-
performance non-objects.
Robust
The multi-platform environment of the Web places extraordinary demands on a
program, because the program must execute reliably in a variety of systems. The ability
to create robust programs was given a high priority in the design of Java. Java is strictly
typed language; it checks your code at compile time and run time.
19
`
navigate through the information based on our interest and preference. A markup
language is simply a series of elements, each delimited with special characters that
define how text or other items enclosed within the elements should be displayed.
Hyperlinks are underlined or emphasized works that load to other documents or some
portions of the same document.
HTML can be used to display any type of document on the host computer, which
can be geographically at a different location. It is a versatile language and can be used
on any platform or desktop.
HTML provides tags (special codes) to make the document look attractive.
HTML tags are not case-sensitive. Using graphics, fonts, different sizes, color, etc., can
enhance the presentation of the document. Anything that is not a tag is part of the
document itself.
20
`
Advantages
A HTML document is small and hence easy to send over the net. It is small because
it does not include formatted information.
HTML is platform independent.
HTML tags are not case-sensitive.
21
`
Bridge, which we will cover shortly. The question now becomes "Why do you need
JDBC?" There are several answers to this question:
1. ODBC is not appropriate for direct use from Java because it uses a C interface.
Calls from Java to native C code have a number of drawbacks in the security,
implementation, robustness, and automatic portability of applications.
2. A literal translation of the ODBC C API into a Java API would not be desirable.
For example, Java has no pointers, and ODBC makes copious use of them,
including the notoriously error-prone generic pointer "void *". You can think of
JDBC as ODBC translated into an object-oriented interface that is natural for
Java programmers.
3. ODBC is hard to learn. It mixes simple and advanced features together, and it
has complex options even for simple queries. JDBC, on the other hand, was
designed to keep simple things simple while allowing more advanced
capabilities where required.
4. A Java API like JDBC is needed in order to enable a "pure Java" solution. When
ODBC is used, the ODBC driver manager and drivers must be manually
installed on every client machine. When the JDBC driver is written completely
in Java, however, JDBC
5. code is automatically installable, portable, and secure on all Java platforms from
network computers to mainframes.
22
`
In the three-tier model, commands are sent to a "middle tier" of services, which
then send SQL statements to the database. The database processes the SQL statements
and sends the results back to the middle tier, which then sends them to the user. MIS
directors find the three-tier model very attractive because the middle tier makes it.
JAVA
Client machine
Application
Possible to maintain control over access and the kinds of updates that can be
made to corporate data. Another advantage is that when there is a middle tier, the user
can employ an easy-to-use higher-level API which is translated by the middle tier into
the appropriate low-level calls. Finally, in many cases the three-tier architecture can
provide performance advantages.
Java applet or
Client machine (GUI)
Html browser
Application
Server machine (business Logic)
Server (Java)
Database server
DBMS
23
`
Until now the middle tier has typically been written in languages such as C or
C++, which offer fast performance. However, with the introduction of optimizing
compilers that translate Java byte code into efficient machine-specific code, it is
becoming practical to implement the middle tier in Java. This is a big plus, making it
possible to take advantage of Java's robustness, multithreading, and security features.
JDBC is important to allow database access from a Java middle tier.
JDBC-ODBC Bridge
If possible, use a Pure Java JDBC driver instead of the Bridge and an ODBC
driver. This completely eliminates the client configuration required by ODBC. It also
eliminates the potential that the Java VM could be corrupted by an error in the native
code brought in by the Bridge (that is, the Bridge native library, the ODBC driver
manager library, the ODBC driver library, and the database client library).
24
`
component model .The Java Server Pages architecture enables the separation of content
generation from content presentation. This separation not eases maintenance
headaches, it also allows web team members to focus on their areas of expertise. Now,
web page designer can concentrate on layout, and web application designers on
programming, with minimal concern about impacting each other’s work.
Features of JSP
Portability
Java Server Pages files can be run on any web server or web-enabled application
server that provides support for them. Dubbed the JSP engine, this support involves
recognition, translation, and management of the Java Server Page lifecycle and its
interaction components.
Components
It was mentioned earlier that the Java Server Pages architecture can include
reusable Java components. The architecture also allows for the embedding of a scripting
language directly into the Java Server Pages file. The components current supported
include Java Beans, and Servlets.
Processing
A Java Server Pages file is essentially an HTML document with JSP scripting
or tags. The Java Server Pages file has a JSP extension to the server as a Java Server
Pages file. Before the page is served, the Java Server Pages syntax is parsed and
processed into a Servlet on the server side. The Servlet that is generated outputs real
content in straight HTML for responding to the client.
Access Models
A Java Server Pages file may be accessed in at least two different ways. A
client’s request comes directly into a Java Server Page. In this scenario, suppose the
page accesses reusable Java Bean components that perform particular well-defined
computations like accessing a database. The result of the Beans computations, called
result sets is stored within the Bean as properties. The page uses such Beans to generate
dynamic content and present it back to the client.
25
`
In both of the above cases, the page could also contain any valid Java code. Java
Server Pages architecture encourages separation of content from presentation.
JDBC connectivity
The JDBC provides database-independent connectivity between the J2EE
platform and a wide range of tabular data sources. JDBC technology allows an
Application Component Provider to:
Perform connection and authentication to a database server
Manager transactions
Move SQL statements to a database engine for preprocessing and execution
Execute stored procedures
Inspect and modify the results from Select statements.
26
`
Client server implementations are complex but the underlying concept is simple
and powerful. A client is an application running with local resources but able to request
the database and relate the services from separate remote server. The software
mediating this client server interaction is often referred to as MIDDLEWARE.
27
`
The key client server idea is that client as user is essentially insulated from the
physical location and formats of the data needs for their application. With the proper
middleware, a client input from or report can transparently access and manipulate both
local database on the client machine and remote databases on one or more servers. An
added bonus is the client server opens the door to multi-vendor database access
indulging heterogeneous table joins.
28
`
Access to these resources was initially confined to batched runs that produced
departmental reports at the appropriate intervals. A strong central information service
department ruled the corporation. The role of the rest of the corporation limited to
requesting new or more frequent reports and to provide hand written forms from which
the central data banks were created and updated. The earliest client server solutions
therefore could best be characterized as “SLAVE-MASTER”.
Time-sharing changed the picture. Remote terminal could view and even
change the central data, subject to access permissions. And, as the central data banks
evolved in to sophisticated relational database with non-programmer query languages,
online users could formulate adhoc queries and produce local reports with out adding
to the MIS applications software backlog. However remote access was through dumb
terminals, and the client server remained subordinate to the Slave\Master
29
`
CHAPTER 4
REQUIREMENT SPECIFICATION
30
`
CHAPTER 5
SOFTWARE DESIGN
5.2 Modules
Bank Admin
In this module, the admin has to login by using valid user name and password.
After login successful he can do some operations such as Bank Admin's Profile ,View
Users and Authorize ,View Ecommerce Website Users and Authorize, Add Bank ,View
Bank Details ,View Credit Card Requests, View all Products with rank ,View all
Financial Frauds ,View all Financial Frauds with Random Forest Tree With wrong
CVV ,View all Financial Frauds with Random Forest Tree with Expired Date Usage
,List Of all Users with Majority of Financial Fraud ,Show Product Rank In Chart ,Show
Majority Voting With Wrong CVV Fraud in chart ,Show Majority Voting with Expiry
date Usage in chart.
31
`
Ecommerce Users
In this module, there are n numbers of users are present. User should register
before doing any operations. Once user registers, their details will be stored to the
database. After registration successful, he has to login by using authorized user name
and password. Once Login is successful user will do some operations like, Add
Category, Add Products, view all Products with rank, and View all Purchased Products
with total bill, View All Financial Frauds.
End Users
In this module, there are n numbers of users are present. User should register
before doing any operations. Once user registers, their details will be stored to the
database. After registration successful, he has to login by using authorized user name
and password. Once Login is successful user will do some operations like, View My
Profile, Manage Bank Account, Request Credit Card, View Credit Card Details,
Transfer Money to Your Credit Card Account, Search for Products by Keyword, View
all Purchased Products with Total Bill.
32
`
The goal is for UML to become a common language for creating models of
objec oriented computer software. In its current form UML is comprised of two major
components: a Meta-model and a notation. In the future, some form of method or
process may also be added to; or associated with, UML.
The UML represents a collection of best engineering practices that have proven
successful in the modeling of large and complex systems.
The UML is a very important part of developing object oriented software and
the software development process. The UML uses mostly graphical notations to express
the design of software projects.
Goals:
The Primary goals in the design of the UML are as follows:
1. Provide users a ready-to-use, expressive visual modeling Language so that they
can develop and exchange meaningful models.
2. Provide extendibility and specialization mechanisms to extend the core
concepts.
3. Be independent of particular programming languages and development process.
4. Provide a formal basis for understanding the modeling language.
5. Encourage the growth of OO tools market.
6. Support higher level development concepts such as collaborations, frameworks,
patterns and components.
33
`
34
`
35
`
The interaction that takes place in a collaboration that either realizes a use case
or an operation (instance diagrams or generic diagrams)
High-level interactions between user of the system and the system, between the
system and other systems, or between subsystems
36
`
CHAPTER 6
SOURCE CODE
Get_pic.jsp
<%@ include file="connect.jsp" %>
<%@ page import="java.sql.*,java.io.*,java.util.*" %>
<%
try{
String pic=request.getParameter("picture");
String p_Name=request.getParameter("p_Name");
int id = Integer.parseInt(request.getParameter("id"));
byte[] imageData=null;
Blob b=null;
if(pic.equalsIgnoreCase("bankadmin"))
{
Statement st=connection.createStatement();
String strQuery = "select image from bankadmin where
id="+id+"" ;
ResultSet rs = st.executeQuery(strQuery);
rs = st.executeQuery(strQuery);
if(rs.next())
{
b = rs.getBlob(1);
imageData=b.getBytes(1, (int)b.length());
}
response.setContentType("image/gif");
OutputStream o=response.getOutputStream();
o.write(imageData);
o.flush();
o.close();
}
else if(pic.equals("userimage"))
37
`
{
Statement st=connection.createStatement();
String strQuery = "select image from user where
id="+id+"" ;
ResultSet rs = st.executeQuery(strQuery);
String imgLen="";
if(rs.next())
{
b = rs.getBlob(1);
imageData=b.getBytes(1, (int)b.length());
}
response.setContentType("image/gif");
OutputStream o=response.getOutputStream();
o.write(imageData);
o.flush();
o.close();
}
else if(pic.equals("productimage"))
{
Statement st=connection.createStatement();
String strQuery = "select p_image from products where
id="+id+"" ;
ResultSet rs = st.executeQuery(strQuery);
String imgLen="";
if(rs.next())
{
b = rs.getBlob(1);
imageData=b.getBytes(1, (int)b.length());
}
response.setContentType("image/gif");
OutputStream o=response.getOutputStream();
38
`
o.write(imageData);
o.flush();
o.close();
}
else if(pic.equals("bankimage"))
{
Statement st=connection.createStatement();
String strQuery = "select b_image from bank where
id="+id+"“;
ResultSet rs = st.executeQuery(strQuery);
String imgLen="";
if(rs.next())
{
b = rs.getBlob(1);
imageData=b.getBytes(1, (int)b.length());
}
response.setContentType("image/gif");
OutputStream o=response.getOutputStream();
o.write(imageData);
o.flush();
o.close();
}
else{}
}
catch (Exception e){
e.printStackTrace();
}
%>
</body>
</html>
Connect.jsp
39
`
<title></title>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*" %>
<%
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection =
DriverManager.getConnection("jdbc:mysql://localhost:3306/cc_fraud","root","root");
String sql="";
}
catch(Exception e)
{
System.out.println(e);
}
%>
String s1,s2,s3,s4,s5,s6,s7;
int i=0;
try
{
String query="select * from financial_fraud";
Statement st=connection.createStatement();
ResultSet rs=st.executeQuery(query);
while ( rs.next() )
{
i=rs.getInt(1);
s1=rs.getString(2);
40
`
s2=rs.getString(4);
s3=rs.getString(5);
s4=rs.getString(6);
s5=rs.getString(8);
s6=rs.getString(9);
s7=rs.getString(10);
if(s7.equalsIgnoreCase("Wrong CVV"))
else{
<td width="17" height="0" align="center" valign="middle"><div align="center"
class="style12">
<b><%out.println(s7);%></b>
</div></td>
}%>
</tr>
}
connection.close();
catch(Exception e)
{
out.println(e.getMessage());
}
protected void processRequest(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try{
OutputStream out=response.getOutputStream();
DefaultCategoryDataset barchart=new DefaultCategoryDataset();
41
`
String title=rs.getString("title");
while(rs1.next()){
String status=rs1.getString("title");
int ex=rs1.getInt(1);
barchart.addValue(ex,"",status);
}
}
JFreeChart BarChartObject=ChartFactory.createBarChart("", "", "count",
barchart, PlotOrientation.VERTICAL, true, true, false);
response.setContentType("image/png");
ChartUtilities.writeChartAsPNG(out,BarChartObject,580,400);
}catch(Exception e){
System.out.println(e);
}
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
42
`
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
43
`
CHAPTER 7
SYSTEM TESTING
Integration testing
Integration tests are designed to test integrated software components to
determine if they actually run as one program. Testing is event driven and is more
concerned with the basic outcome of screens or fields. Integration tests demonstrate
that although the components were individually satisfaction, as shown by successfully
unit testing, the combination of components is correct and consistent. Integration
testing is specifically aimed at exposing the problems that arise from the combination
of components.
44
`
Functional test
Functional tests provide systematic demonstrations that functions tested are
available as specified by the business and technical requirements, system
documentation, and user manuals.
Functional testing is centered on the following items:
Valid Input : identified classes of valid input must be accepted.
Invalid Input : identified classes of invalid input must be rejected.
Functions : identified functions must be exercised.
Output : identified classes of application outputs must be exercised.
Systems/Procedures : interfacing systems or procedures must be invoked.
System Test
System testing ensures that the entire integrated software system meets
requirements. It tests a configuration to ensure known and predictable results. An
example of system testing is the configuration oriented system integration test. System
testing is based on process descriptions and flows, emphasizing pre-driven process links
and integration points.
45
`
46
`
CHAPTER 8
OUTPUT SCREENS
47
`
The above screen is about the all users authorize by the bank admin
48
`
The above screen is about the all ecommerce authorize by the bank admin.
49
`
50
`
The above screen is about the products category list in the ecommerce site.
The above screen is about the Adding products to the ecommerce site.
51
`
The above screen is about viewing of all product with the ranks in the ecommerce
site.
52
`
The above screen is about the user home page and operations.
53
`
The above screen is about user request for the credit card send to bank admin.
The above screen about details of the credit card that is generated by bank admin.
54
`
The above screen is about the user searching for the product by using the keyword.
The above screen about the purchases made by the user and their total bill amount.
55
`
The above screen is about the all financial fraud made by the user using credit card.
The above screen is about the all-financial fraud with wrong CVV made by user.
56
`
The above screen is about the all financial fraud with expired card made by user.
The above screen is about the all products and their ranks.
57
`
The above screen is about majority number of frauds made by using wrong CVV.
The above screen is about the majority number of frauds made by expired card.
58
`
CHAPTER 10
CONCLUSION
A study on credit card fraud detection using machine learning algorithms has been
presented in this project. A number of standard models which include NB, SVM, and
DL have been used in the empirical evaluation. A publicly available credit card data
set has been used for evaluation using individual (standard) models and hybrid models
using AdaBoost and majority voting combination methods. The MCC metric has been
adopted as a performance measure, as it takes into account the true and false positive
and negative predicted outcomes. The best MCC score is 0.823, achieved using
majority voting. A real credit card data set from a financial institution has also been
used for evaluation. The same individual and hybrid models have been employed. A
perfect MCC score of 1 has been achieved using AdaBoost and majority voting
methods. To further evaluate the hybrid models, noise from 10% to 30% has been
added into the data samples. The majority voting method has yielded the best MCC
score of 0.942 for 30% noise added to the data set. This shows that the majority voting
method is stable in performance in the presence of noise. For future work, the methods
studied in this paper will be extended to online learning models. In addition, other
online learning models will be investigated. The use of online learning will enable
rapid detection of fraud cases, potentially in real-time. This in turn will help detect and
prevent fraudulent transactions before they take place, which will reduce the number of
losses incurred every day in the financial sector.
59
`
CHAPTER 11
REFERENCES
60
`
11. E. Duman and M. H. Ozcelik, “Detecting credit card fraud by genetic algorithm
and scatter search,” Expert Systems with Applications, vol. 38, no. 10, pp.
13057–13063, 2011.
12. P. Ravisankar, V. Ravi, G. R. Rao, and I. Bose, “Detection of financial
statement fraud and feature selection using data mining techniques,” Decision
Support Systems, vol. 50, no. 2, pp. 491–500, 2011.
13. E. Kirkos, C. Spathis, and Y. Manolopoulos, “Data mining techniques for the
detection of fraudulent financial statements,” Expert Systems with
Applications, vol. 32, no. 4, pp. 995–1003, 2007.
14. F. H. Glancy and S. B. Yadav, “A computational model for financial reporting
fraud detection,” Decision Support Systems, vol. 50, no. 3, pp. 595–601, 2011.
15. D. Olszewski, “Fraud detection using self-organizing map visualizing the user
profiles,” Knowledge-Based Systems, vol. 70, pp. 324–334, 2014.
61