0% found this document useful (0 votes)
2 views25 pages

Credit Card Fraud Detection_python

This project report details the development of a machine-learning model for detecting credit card fraud using Python, submitted by Devadharshini R as part of her engineering degree. The report outlines the significance of credit card fraud, the methodologies employed, and the technologies learned during the internship at PCS Software Solutions. Key components include data collection, cleaning, and the application of various machine learning algorithms to identify fraudulent transactions.

Uploaded by

pcstech2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views25 pages

Credit Card Fraud Detection_python

This project report details the development of a machine-learning model for detecting credit card fraud using Python, submitted by Devadharshini R as part of her engineering degree. The report outlines the significance of credit card fraud, the methodologies employed, and the technologies learned during the internship at PCS Software Solutions. Key components include data collection, cleaning, and the application of various machine learning algorithms to identify fraudulent transactions.

Uploaded by

pcstech2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

CREDIT CARD FRAUD DETECTION USING PYTHON

AN INTERNSHIP

PROJECT REPORT

Submitted by

DEVADHARSHINI R
Register No. 720323106016

A report submitted in partial fulfillment of the requirements for the award of


Degree of

BACHELOR OF ENGINEERING
IN
ELECTRONICS AND COMMUNICATION ENGINEERING

AKSHAYA COLLEGE OF ENGINEERING AND


TECHNOLOGY, COIMBATORE-642 109

ANNA UNIVERSITY: CHENNAI -600 025

FEBRUARY 2025
AKSHAYA COLLEGE OF ENGINEERING AND
TECHNOLOGY, COIMBATORE-642 109
ANNA UNIVERSITY: CHENNAI- 600 025
Bhagavathipalayam, Kinathukadavu, Coimbatore- 642109
Tamilnadu, India.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING

BONAFIDE CERTIFICATE

Certified that this project “CREDIT CARD FRAUD DETECTION USING


PYTHON” is the bonafide of “DEVADHARSHINI R” who carried out the project work
under our supervision.

Internship Coordinator Head of the Department


Miss.Mariswari@Manju Mr.
Software Developer, Assistant Professor
PCS Software Solutions, Akshaya College of
Surandai-627859. Engineering And Technology,
Coimbatore -642 109
AKCNOWLEDGEMENT

Firstly, I express my heartiest thanks and gratefulness to almighty God for His divine blessing
makes us possible to complete the project work successfully.

I really grateful and wish my profound my indebtedness to Supervisor

Miss.Mariswari@Manju Software Developer, PCS Software Solutions, Surandai-627859.


Deep Knowledge & keen interest of my supervisor in the field of web development has helped me
enormously to carry out this project. Her endless patience, scholarly guidance, continual
encouragement, constant and energetic supervision, constructive criticism, valuable advice, reading
many inferior drafts and correcting them at all stage have made it possible to complete this project.

I would like to express my heartiest gratitude to Mr.xxxxxx, Department of ECE, for his kind help
to finish my project.

I would also generously welcome each one of those individuals who have helped me straight
forwardly or in a roundabout way in making this project a win. In this unique situation, I might
want to thank the various staff individuals, both educating and non-instructing, which have
developed their convenient help and facilitated my undertaking.

Finally, I must acknowledge with due respect the constant support and patients of my parents.

DEVADHARSHINI R
(720323106016)
TABLE OF CONTENTS

Content Page No.

CERTIFICATE
AKCNOWLEDGEMENT
TABLE OF CONTENTS
ABSTRACT 5
CHAPTER 1 COMPANY PROFILE 6
CHAPTER 2 WEEKLY OVERVIEW OF INTERNSHIP ACTIVITIES 8
CHAPTER 3 INTRODUCTION 11
CHAPTER 4 TECHNOLOGY LEARNT 14
CHAPTER 5 SYSTEM SPECIFICATION 15
CHAPTER 6 PROJECT DESCRIPTION 16
CHAPTER 7 CODING 19

CHAPTER 8 RESULTS 22
CHAPTER 9 CONCLUSION 23
CHAPTER 10 REFERENCES 24
ABSTRACT

Credit card fraud is a significant problem, with billions of dollars lost each year.
Machine learning can be used to detect credit card fraud by identifying patterns
that are indicative of fraudulent transactions. Credit card fraud refers to the
physical loss of a credit card or the loss of sensitive credit card information.
Many machine-learning algorithms can be used for detection. This project
proposes to develop a machine-learning model to detect credit card fraud. The
model will be trained on a dataset of historical credit card transactions and
evaluated on a holdout dataset of unseen transactions.
CHAPTER 1
COMPANY PROFILE

PCS Software Solutions is an independent software development and training


company, driven by industry experts and thought leaders in Web/Mobile
development and training domain. We work with some of the smartest software-
driven businesses around the world including software product start-ups as well
as MNC over 50 companies. We offer Website Development and Hosting
Services at affordable price. We develop the Website and as well as take over
the responsibility of maintaining your Website PCS offers the most effective
and result oriented Digital / Online Marketing Strategies for clients to establish
a good image of their brand in the Digital and Social Media. With keen industry
expertise and market knowledge, we will analyze the targeted audience to
determine the best way of business promotion through Digital Marketing using
various Online Promotions in Google, Facebook, Instagram & Youtube
Promotions.

VISION:
Be a global force in innovative solutions, quality excellence and redefine
creative thoughts. Striving to be a global force in innovative solutions, quality
excellence, and the redefinition of creative thoughts, we embark on a journey
that transcends boundaries. Our commitment extends beyond mere problem-
solving; it encompasses a vision to reshape industries and leave an indelible
mark on the global landscape. At the core of our mission is a relentless pursuit
of innovation, where we challenge the status quo and push the limits of what is
conceivable.
MISSION:
We endeavour to bring innovative solutions to the forefront, employing a simple
yet effective approach that underscores our commitment to providing deserving
quality. Our mission is rooted in a dedication to pushing the boundaries of
what's possible, embracing creativity, and maintaining a relentless pursuit of
excellence. By adhering to these principles, we aim to not only meet but exceed
the expectations of our users, clients, and partners. Through a combination of
forward-thinking strategies and a focus on quality, we strive to make a
meaningful impact in every endeavour we undertake.

OUR SERVICES

 WEBSITE DEVELOPMENT

 MOBILE APPLICATION DEVELOPMENT

 E-COMMERCE

 WORDPRESS DEVELOPMENT

 OUTSOURCING

 CLOUD SERVICES

 DIGITAL MARKETING

 SEO

 COLLEGE PROJECT
 INTERNSHIP

 SOFTWARE TRAINING

CHAPTER 2
WEEKLY OVERVIEW OF INTERNSHIP ACTIVITIES

DATE DAY NAME OF THETOPIC/MODULE


COMPLETED
08/07/2024 Monday Introduction About Python & Comments,
1st WEEK

Variables
09/07/2024 Tuesday Datatypes

10/07/2024 Wednesday Operators – Boolean

11/07/2024 Thursday Functions

12/07/2024 Friday Arrays

DATE DAY NAME OF THETOPIC/MODULE


COMPLETED
2nd WEEK

15/07/2024 Monday Control flow statements

16/07/2024 Tuesday Tuples and Sequences

18/07/2024 Thursday LOOPS


19/07/2024 Friday Task

DATE DAY NAME OF THETOPIC/MODULE


COMPLETED
22/07/2024 Monday Classes
3rd WEEK

23/7/2024 Tuesday Objects

24/07/2024 Wednesday Packages

25/07/2024 Thursday Errors and Exceptions


26/07/2024 Friday Task

DATE DAY NAME OF THETOPIC/MODULE


COMPLETED
30/07/2024 Monday ML- Algorithms, Binary Search
Algorithm
4th WEEK

31/07/2024 Tuesday DFS Algorithms

01/08/2024 Wednesday Regression Algorithms

02/08/2024 Thursday Confusion Matrix

03/08/2024 Friday Task & Live Project Explanation


DATE DAY NAME OF THETOPIC/MODULE
COMPLETED
5/08/2024 Monday Project Requirement Analysis
5th WEEK

6/08/2024 Tuesday Modules development

07/08/2024 Wednesday Debugging


08/08/2024 Thursday Project Completion

CHAPTER 3
INTRODUCTION

“Fraud” in credit card transaction is unauthorized and unwanted usage of


an account by someone other than the owner of the account. Necessary
prevention measures can be taken to stop this abuse and the behaviour of
such fraudulent practices can be defined as a case where a person uses
someone else’s credit card for personal reasons while the owner and the
card issuing authorities are unaware of the fact that the card is being used.

In today’s era, with the widespread use of credit cards for online
transactions, the risk of fraudulent activities has increased significantly.
Addressing this challenge demands sophisticated methods that can
swiftly and accurately detect fraudulent
transactions to safeguard financial assets and uphold customer trust.

FIG.1: Credit Card fraud detection image


Fraud detection involves monitoring the activities of populations of users in
order to estimate, perceive or avoid objectionable behavior, which consist of
fraud, intrusion, and defaulting.

Internship Objectives
 Internships are generally thought of to be reserved for college students looking
to gain experience in a particular field. However, a wide array of people can
benefit from Training Internships in order to receive real world experience and
develop their skills.
 An objective for this position should emphasize the skills you already possess in
the area and your interest in learning more
 Internships are utilized in a number of different career fields, including
architecture, engineering, healthcare, economics, advertising and many more.
 Some internship is used to allow individuals to perform scientific research while
others are specifically designed to allow people to gain first-hand experience
working.
 Utilizing internships is a great way to build your resume and develop skills that
can be emphasized in your resume for future jobs. When you are applying for a
Training Internship, make sure to highlight any special skills or talents that can
make you stand apart from the rest of the applicants so that you have an
improved chance of landing the position.

.MOTIVATION FOR INTERNSHIP


My motivation for this internship was rooted in a desire to learn about web
development, gain practical experience, and contribute to meaningful
projects. This experience not only aimed to solidify my technical expertise
but also to prepare me for a successful career in an ever-evolving
technological landscape.

The motivation behind pursuing this internship was driven by my passion


for combining web development to create efficient, secure, and user-friendly
Web Applications. In an increasingly interconnected digital world, the
synergy between front-end development and back-end development is
crucial for delivering seamless online experiences. I recognized that gaining
practical experience in both domains would be instrumental in advancing
my career and contributing meaningfully to the tech industry.
From a Software development perspective, my interest in PYTHON
stemmed from the desire to build interactive and aesthetically pleasing web
interfaces. However, I also understood that even the most beautifully
designed Web applications require a Programming language like JavaScript
to create dynamic websites.
The decision to undertake this internship was further motivated by the
opportunity to work in a professional setting, where I could apply my
theoretical knowledge to real-world scenarios. I was eager to face the
challenges and complexities of integrating software development with
network management, learning from industry experts, and gaining hands-on
experience with cutting-edge technologies.
Additionally, I was motivated by the prospect of contributing to projects that
have a tangible impact on users and organizations. The chance to enhance
network performance, implement security protocols, and ensure high
availability of applications aligned with my long-term career goals of
becoming a proficient full-stack developer with a strong foundation in
PYTHON.

This internship also offered a platform to develop essential soft skills such
as teamwork, problem- solving, and project management. Collaborating
with professionals from diverse backgrounds and working on
interdisciplinary projects provided a holistic learning experience that
extended beyond technical knowledge.

In summary, my motivation for this internship was rooted in a desire to


bridge the gap between software developments, gain practical experience,
and contribute to meaningful projects. This experience not only aimed to
solidify my technical expertise but also to prepare me for a successful career
in an ever-evolving technological landscape.
CHAPTER 4
TECHNOLOGIES LEARNT
 Python

 Python is an easy to learn, powerful programming language. It has


efficient high-level data structures and a simple but effective
approach to object-oriented programming.
 Python’s elegant syntax and dynamic typing, together with its
interpreted nature, make it an ideal language for scripting and rapid
application development in many areas on most platforms.
 The Python interpreter is easily extended with new functions and
data types implemented in C or C++ (or other languages callable
from C).
 Python is also suitable as an extension language for customizable
applications.

 Machine Learning

Machine learning algorithms are essentially sets of instructions that


allow computers to learn from data, make predictions, and improve
their performance over time without being explicitly programmed.
Machine learning algorithms are broadly categorized into three
types:
 Supervised Learning: Algorithms learn from labeled data, where the
input-output relationship is known.
 Unsupervised Learning: Algorithms work with unlabeled data to identify
patterns or groupings.
 Reinforcement Learning: Algorithms learn by interacting with an
environment and receiving feedback in the form of rewards or penalties.

CHAPTER 5

SYSTEM REQUIREMENTS

The software requirement specification can produce at the culmination of the


analysis task. The function and performance allocated to software as part of
system engineering are refined by established a complete information
description, a detailed functional description, a representation of system
behavior, and indication of performance and design constrain, appropriate
validate criteria, and other information pertinent to requirements.
Software Requirements:
Language : Python 3.x
Text Editor : Visual Code
Operating System : Windows 10.

Hardware Requirements:
Processor : Intel core i5
Memory : 8GB RAM
Hard Disk : 1TB

Algorithms Used:

K-Nearest Neighbor (KNN)


Logistic Regression (L.R.)
Support Vector Machine (SVM)
Decision Tree (D.T.)

CHAPTER 6
PROJECT DESCRIPTION

'Fraud' in credit card transactions is unauthorized and unwanted usage of an


account by someone other than the owner of that account. Fraud has been
increasing drastically with the progression of state-of-art technology and
worldwide communication. Credit cards are one of the most prevalent fraud
objectives but not the only one. Credit card fraud is the wide-ranging term for
theft and fraud committed or any similar payment mechanism as a fraudulent
resource of funds in a transaction. Credit card fraud has been an expanding issue
in the credit card industry. Detecting credit card fraud is difficult when using
normal processes, so developing credit card fraud detection models has become
essential in academic or business organizations. Fraud can be avoided in two
main ways: prevention and detection. Prevention avoids any attacks from
fraudsters by acting as a layer of protection. Detection happens once the
prevention has already failed. Therefore, detection helps identify and alert as
soon as a fraudulent transaction is triggered.
Machine learning is this generation's solution, which replaces such
methodologies and can work on large datasets, which is impossible for human
beings. Machine learning techniques fall into two main categories: supervised
and unsupervised. Fraud detection can be done either way and can only be
decided when to use according to the dataset. Supervised learning requires prior
classification of anomalies. During the last few years, several supervised
algorithms have been used in detecting credit card fraud. The data used in this
study is analyzed in two main ways: categorical data and numerical data. The
dataset initially came with categorical data. The raw data can be prepared by
data cleaning and other basic preprocessing techniques. First, categorical data
can be transformed into numerical data, and then appropriate techniques are
applied for the evaluation. Secondly, categorical data is used in machine
learning techniques to find the optimal algorithm.
This project consists of selecting optimal algorithms for fraud patterns through
an extensive comparison of machine learning such as Logistic Regression, KNN
Neighbors, and Decision Trees—techniques via an effective performance
measure for detecting fraudulent credit card transactions. The rest of this paper
is presented as follows. Section 2 offers the literature review. Section 3 provides
the experimental methodology, including results. Finally, conclusions and
discussions of the paper are presented in Section 4.
PROJECT PLAN

Fig: Project plan.

The project will be completed in different phases:


Data collection:
The first phase will involve collecting a dataset of historical credit card
transactions. The data will be collected from various sources, including
banks, credit card companies, and merchants.

Data Cleaning:

 Impute the missing values with the column's mean, median, or mode.
 Drop the rows with missing values.
 Use a machine learning model to predict the missing values like isnull()
and heatmap().

Normalize the data:

Normalization is scaling the data so that all features have similar values.
This can improve the performance of machine learning models by making
the parts more comparable.
Model training:
The second phase will involve training the machine learning model on the
collected data. The model will be prepared using a supervised learning
algorithm like SVM.
Model evaluation:
The third phase will involve evaluating the machine learning model's
performance on a holdout dataset of unseen transactions. The model's
performance will be evaluated using accuracy, precision, and recall
metrics.

Fig: Working Flow of Credit Card Fraud Detection

Existing System
The traditional credit card fraud detection systems primarily rely on rule-based
approaches and manual review processes. These systems have several
limitations:
Rule-Based Systems: Use predefined rules (e.g., transactions above a certain
amount are flagged).High false-positive rates (legitimate transactions get
flagged). Cannot adapt to new fraud patterns dynamically.
Manual Reviews: Involves human analysts reviewing flagged transactions.
Slow, expensive, and not scalable for large transaction volumes.
Static Models: Older machine learning models with limited learning
capabilities. Struggle to detect emerging fraud techniques.
Challenges: High false positives and false negatives. Delayed detection leading
to financial losses. Inability to adapt to evolving fraud tactics.

Proposed System
The proposed system leverages machine learning (ML) and artificial
intelligence (AI) to improve fraud detection with better accuracy and real-time
processing.
Machine Learning Algorithms:
Uses supervised (Decision Trees, Random Forest, SVM, Neural Networks) and
unsupervised learning (K-Means, Isolation Forest, Autoencoders) for anomaly
detection.
Real-Time Detection: ML models process transactions in real-time, instantly
flagging suspicious activity.
Pattern Recognition & Adaptability: Models continuously learn from new
transaction data to detect evolving fraud patterns.
Feature Engineering & Data Analysis: Extracts meaningful features from
transaction data (e.g., transaction location, time, frequency).
Reducing False Positives: ML models improve accuracy, reducing
unnecessary transaction declines.
Deep Learning & Neural Networks: Advanced models like LSTMs can detect
sequential fraud behavior over time.
CHAPTER 7
SOURCE CODE

K-Nearest Neighbor(KNN)
import pandas as pd
import numpy as np

import seaborn as sns


import matplotlib.pylab as plt

{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Credit Card Fraud Detection - Logistic Regression"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "TDnoEQTWStTz"
},
"source": [
"Importing the Dependencies"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"id": "hlNfrSC1PGfZ"
},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"from sklearn.model_selection import train_test_split\n",
"from sklearn.linear_model import LogisticRegression\n",
"from sklearn.metrics import accuracy_score"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"id": "W0CTsNioTKnJ"
},
"outputs": [],
"source": [
"# loading the dataset to a Pandas DataFrame\n",
"credit_card_data = pd.read_csv('creditcard.csv')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 218
},
"id": "o_iMfyHsTa6s",
"outputId": "318bdb4d-9f20-4789-c6e6-9b2de1aad091"
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
CHAPTER 8
RESULTS AND DISCUSSION

Expected Result:
 A machine learning model that can detect credit card fraud with high
accuracy.
 A better understanding of the patterns that are indicative of fraudulent
transactions.
 A framework for using machine learning to detect real-time credit
card fraud.

Performance Metrics and Evaluation Methodology:


Confusion Metrics:
A Confusion matrix is an N x N matrix used for evaluating the performance of a
classification model, where N is the number of target classes. The matrix
compares the actual target values with those the machine learning model
predicted.
Classification Report:
CHAPTER 9
CONCLUSION AND FUTURE ENHANCEMENT

CONCLUSION:

In conclusion, the main objective of this project was to find the most suited
model for credit card fraud detection in terms of the machine learning
techniques chosen for the project. It was met by building the four models and
finding the accuracies of them all; the best in terms of accuracy is KNN and
Decision Tree, which scored 100 on credit card fraud and increased the
customer’s satisfaction as it will provide them with a better experience and
feeling secure.

FUTURE ENHANCEMENT:

There are many ways to improve the model, such as using it on different
datasets with various sizes and data types or by changing the data splitting ratio
and viewing it from a different algorithm perspective. An example can be
merging telecom data to calculate the location of people to have better
knowledge of the location of the card owner while his/her credit card is being
used; this will ease the detection because if the card owner is in Dubai and a
transaction of his card was made in Abu Dhabi, it will easily be detected as
Fraud.

CHAPTER 10
REFERENCES

 J. O. Awoyemi, A. O. Adentumbi, S. A. Oluwadare, “Credit card fraud


detection using Machine Learning Techniques: A Comparative Analysis”,
Computing Networking and Informatics (ICCNI), 2017 International
Conference on pp. 1-9. IEEE.
 R. Choudhary and H. K. Gianey 2017 Int. Conf. Mach. Learn. Data Sci.,
pp. 3743, 2017.
 G. E. Melo-Acosta, F. Duitama-Muñoz, and J. D. Arias-Londoño, -
supervised
 Common. Compute. (COLCOM), 2017 IEEE Colomb. Conf., pp. 16,
2017.
 Survey of Credit Card Fraud Detection Techniques: Data and Technique
Oriented 26, 2016
 Credit Card Fraud Detection dataset: downloaded from Kaggle,
September 2013 by European cardholders.

You might also like