0% found this document useful (0 votes)
17 views

23MZ02

The project focuses on developing a credit card fraud detection system using Explainable AI (XAI) methods to enhance transparency and trust in AI decisions. It aims to implement machine learning techniques like XGBoost and Decision Trees, along with XAI methods such as SHAP and LIME, to effectively identify fraudulent transactions and provide clear explanations for flagged cases. The study includes a comprehensive literature survey, system design, dataset description, and feature selection to ensure robust fraud detection capabilities.

Uploaded by

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

23MZ02

The project focuses on developing a credit card fraud detection system using Explainable AI (XAI) methods to enhance transparency and trust in AI decisions. It aims to implement machine learning techniques like XGBoost and Decision Trees, along with XAI methods such as SHAP and LIME, to effectively identify fraudulent transactions and provide clear explanations for flagged cases. The study includes a comprehensive literature survey, system design, dataset description, and feature selection to ensure robust fraud detection capabilities.

Uploaded by

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

21ZC71 PROJECT WORK – I

FINAL REVIEW

Title: Credit Card Fraud Detection Using Explainable AI Methods

Presented by Project Guide Name & Designation:


R.M.Sireesha Dr.Suriya S,
Associate Professor,
ME- CSE
Department of Computer Science and Engg.,
PSG College of Technology PSG College of Technology
Synopsis
 Problem Statement
 Motivation
 Abstract
 Literature Survey
 System Design
 System Requirements
 Proposed Method
 Dataset Description
 Feature Selection
 Importance of Features
References
Problem Statement

The challenge is to create a system that can detect fraudulent credit card transactions
automatically and provide clear explanations for flagged transactions, thereby enhancing
customer trust, ensuring regulatory compliance, and improving fraud detection accuracy
over time, utilizing Explainable AI techniques.
Motivation

For instance, Experian's 2024 Fraud Forecast discusses the increasing use of generative
AI for deepfakes and synthetic identity fraud, both of which are growing concerns in the
financial sector. Companies like Google and IBM are also heavily involved in developing
AI-driven fraud detection solutions with a strong emphasis on transparency and
explainability. These companies use XAI principles to ensure that their fraud detection
models are not only effective but also interpretable, fostering greater trust and compliance
in financial services.
Abstract

Explainable AI (XAI) is a technology that aids in understanding how AI makes decisions,


thereby building trust in AI systems. In the realm of credit card fraud detection, XAI
techniques like LIME and SHAP are used to break down complex decisions into
understandable parts. These methods, developed by companies like IBM, ensure
transparency and fairness in AI models. The project aims to make fraud detection systems
more effective, enabling everyone involved to understand why certain transactions are
flagged as fraudulent and take appropriate actions.
Objective

• This study aims to investigate and evaluate XAI methods for credit card fraud detection.
To achieve this aim, three objectives are stated as follows:
• Objective 1: Investigate the current application of ML methods and XAI methods in the
area of credit card fraud detection to gain background knowledge for the implementation
of objectives 2 and 3.
• Objective 2: Implement two ML methods and apply them to the credit card fraud dataset
and evaluate the performance of these two ML methods in terms of their accuracy,
recall, precision, and F1 score.
• Objective 3: Implement SHAP and LIME and apply them to the results obtained in
objective 2.
Literature Survey
System Design
1. Data Collection Layer
• Transaction Data: Collect data related to credit card transactions including features
such as transaction amount, transaction location, time, merchant details, etc.
• User Data: Information about the cardholder such as their spending patterns, location,
and device information.

2. Data Preprocessing Layer


• Data Cleaning: Handle missing values, remove duplicates, and correct inconsistencies
in the data.clear data is essential for accurate model performance.
3. Machine Learning Model Layer
• Chooses and trains smart algorithms (like decision trees or XG Boost ) to recognize
patterns that might indicate fraud.

4. Explainability Layer
• LIME (Local Interpretable Model-agnostic Explanations): Use LIME to explain individual
predictions by approximating the model locally with an interpretable model.
• SHAP (SHapley Additive exPlanations): Use SHAP to provide consistent and locally
accurate explanations for the predictions made by the models.

5. Fraud Detection Layer


• Real-time Detection: Implement the trained models in a real-time environment to score
incoming transactions and flag potential frauds.
• Batch Detection: Periodically analyze batches of transactions to detect fraud that might
not be apparent in real-time.
6. Decision-Making Layer
Sends alerts for flagged transactions to fraud analysts, along with
explanations to help them decide whether the transaction is genuinely
fraudulent.

7. Feedback and Learning Layer


Gathers feedback from analysts to improve the models and regularly updates
them to keep up with new fraud techniques.

8. Monitoring and Maintenance Layer


• Performance Monitoring: Continuously monitor the performance of the
fraud detection models and the explainability tools.
• System Maintenance: Regularly update the system components and
address any issues that arise to ensure optimal performance.
System Requirements

• Python 3.x environment.


• Machine learning libraries: scikit-learn, TensorFlow or PyTorch.
• Libraries for explainability: LIME, SHAP.
• Data handling and processing libraries: pandas, NumPy.
• Integrated Development Environment (IDE) such as Jupyter Notebook
Proposed Method

For detecting credit card fraud uses machine learning models like XGBoost and
Decision Trees to analyze transaction data. The dataset includes features like
distance, transaction amount, and PIN or chip usage. LIME and SHAP
explainability models are used to enhance transparency and trust in the model's
decisions, aiming to improve fraud detection accuracy and interpretability.
Dataset Description
The dataset used in the study focuses on credit card transactions and is designed to analyze
various trends and circumstances that contribute to fraudulent activities in digital payments
Data Dictionary
• transdatetrans_time: Transaction DateTime
• merchant: Merchant Name
• category: Category of Merchant
• amt: Amount of Transaction
• city: City of Credit Card Holder
• state: State of Credit Card Holder
• lat: Latitude Location of Purchase
• long: Longitude Location of Purchase
• city_pop: Credit Card Holder's City Population
• job: Job of Credit Card Holder
• dob: Date of Birth of Credit Card Holder
• trans_num: Transaction Number
• merch_lat: Latitude Location of Merchant
• merch_long: Longitude Location of Merchant
• is_fraud: Whether Transaction is Fraud (1) or Not (0)
Feature Selection
• Based on the previous findings, we are going to use the XGBoost Classifier
model paying particular attention to the settings of its hyperparameters, due to
the unbalanceness of the dataset.

• Furthermore, the following columns will be considered as features of the model:

Since amount, merchant and geographical information are likely to be


useful to recognize a fraudulent transaction.
Feature Selection
• Transaction Amount (amt): Fraudulent transactions often have unusual amounts.
• Location (lat, long, merch_lat, merch_long): The location of the purchase and the
merchant can indicate fraud patterns.
• Merchant Category (category_encoded): Some types of merchants are more prone
to fraud.
• Cardholder's City and State (city_encoded, state_encoded): Fraud rates can vary
by region.
• Cardholder's Age (age): Certain age groups might be more vulnerable to fraud.
• Transaction Time (trans_date_trans_time_unix): Fraud might be more likely at
specific times.
Data Exploration (1)
•Let’s take a look at the distribution of ‘Category ’ and ‘Job’ variables.
•Both variables contain various categorical values, we necessitate encoding them properly if we want to include them as features of the model.
Data Exploration (2)
•Let’s take a look at the distribution of ‘state’ and ‘city’ variables.

•Both variables contain various categorical values, we necessitate encoding them


properly if we want to include them as features of the model.
Data Exploration (3)

•On the below we can see the distribution of ‘merchants’ variable.


•Similarly to previous categorical variables, we need to encode ‘merchant’ values as well.
Data Exploration (4)

•The distribution is unbalanced,


only 1782 out of 3,36,970, have
been classified as fraud.
SMOTE (Synthetic Minority Over-sampling
Technique)
After SMOTE
•We need to use a robust model such as XGBoost and SMOTE,
appropriately to set up its hyperparameters in order to manage such Is_fraud
unbalanced dataset. 0 270270
Key hyperparameters that can be tuned for handling unbalanced datasets 1 270270
include:
 scale_pos_weight: This parameter helps balance the positive (fraud)
and negative (legitimate) class weights.
 learning_rate, n_estimators, max_depth: These standard XGBoost
hyperparameters control the learning process and the complexity of the
model.
Test Analysis Of Correlation Matrix

• From the correlation matrix, we can


see that a few columns are correlated
between each other.

• For example, ‘state_encoded’ and ‘lat’


columns are positively correlated by a
factor of 0.46. Meanwhile, ‘merch_lat’
and ‘lat’ are strongly correlated by a
factor of 0.99.

• ‘is_fraud’ column has a slight negative


correlation with ‘amt’ by a factor of -
0.20.
SHAP – Global Explanation
explainer = shap.Explainer(model_XGB, X_train)

shap_values = explainer.shap_values(X_test)

shap.summary_plot(shap_values,
X_test,
feature_names = features)

• From the summary plot we can see the impact


of each variable on the model output.

• On average ‘amt’ (amount) and (merchant)


‘category_encoded’ variables are the most
important in terms of impact on model output.

• Generally speaking, the higher amount value is,


the more positive its impact. The lower its value,
the more negative its impact (except for a small
range of values between 0 and 1).
shap_values = explainer(X_test.iloc[:500])

shap.plots.heatmap(shap_values)

• Let’s take a set containing the first


500 records of the test dataset and
explain their outputs.

• From the heatmap we can see the


impact of the features for each
instances within the set.

• Looking at amt (amount) feature:


from instance number ~100 to ~200
its impact is very high, while from
instance number ~350 to ~500 its
impact is very negative.
SHAP – Local Explanation
instance_idx = 8

shap_values = explainer(X_test.iloc[instance_idx])

shap.force_plot(explainer.expected_value, shap_values.values, X_test.iloc[instance_idx])

• Let’s choose two indexes (8, 28) of different cases (is_not_fraud, is_fraud) in order to
locally explain their predictions.

• From the force plot, we can see that the (negative) contribution given by the features in
blue has had a negative impact on the local prediction. In other words, the plot shows
which features are pushing the prediction to the right or left.

In this particular case, we can see how amt (amount) and trans_date_trans_time_unix pushed
the prediction to the left of the base value
•In this case, we can see how ‘amt’ feature majorly
instance_idx = 28 pushed the prediction to the right of the base value.

•The top contributor is ‘amt’ feature.


LIME
instance_idx = 8

lime_explainer =
LimeTabularExplainer(X_train.values,mode="classification",
feature_names=features, class_names=[‘is_not_fraud‘,’is_fraud’])

explanation =
lime_explainer.explain_instance(X_test.values[instance_idx],
model_XGB.predict_proba,num_features=len(X_test.columns))

explanation.show_in_notebook()

• Now, let’s apply LIME to the same local instances (8, 28).

• In this case (instance id = 8), from the prediction


probabilities we can see that the amt feature pushed the
model to classify the prediction as not-fraud.

• Trans_date_trans_time_unix feature had a slight impact


as well.
instance_idx = 28

In this case, we can see the negative impact of ‘amt’ feature on the prediction, pushing the
prediction probability to classify the prediction as fraud.
SHAP vs LIME
•Let’s consider the first instance (index = 8) and compare its (local) SHAP and LIME results.
•From the plots, we can see that the impact of the most important features has been captured by both methods,
such as ‘amt’, ‘trans_date_trans_time_unix’, ‘category_encoded’, ‘merch_long’, etc.
•In conclusion, to explain this local prediction both methods look valid.
TREE BASED INTEGRATED GINI ENTROPY:

• Gini impurity is the frequency of an element being erroneously categorized if


labeled randomly based on the dataset's label distribution.
• The scale spans from 0 to 0.5, with 0 representing complete purity (only one class
present) and higher values indicating more mixed classes.

Formula
Gini Index = 1 — Σ ( pi )²
Feature Importance
IMPORTANCE OF FEATURES

Feature Importance

amt 64.91

merch_long 5.14

long 5.14

city_pop 5.14

merch_lat 5.14

lat 5.14

Others 9.19

Out of a total feature importance score of 100, the amount (amt) feature stands out
substantially with a contribution of 64.91, indicating that transaction amount is the most
important factor in the model's decision-making process for detecting fraudulent
transactions.
References
1. N. Dhieb, H. Ghazzai, H. Besbes and Y. Massoud, "A Secure AI-Driven Architecture for Automated Insurance
Systems: Fraud Detection and Risk Measurement," in IEEE Access, vol. 8, pp. 58546-58558, 2020, doi:
10.1109/ACCESS.2020.2983300.
2. R. Li, Z. Liu, Y. Ma, D. Yang and S. Sun, "Internet Financial Fraud Detection Based on Graph Learning," in IEEE
Transactions on Computational Social Systems, vol. 10, no. 3, pp. 1394-1401, June 2023, doi:
10.1109/TCSS.2022.3189368.
3. Z. Zhang, L. Chen, Q. Liu and P. Wang, "A Fraud Detection Method for Low-Frequency Transaction," in IEEE
Access, vol. 8, pp. 25210-25220, 2020, doi: 10.1109/ACCESS.2020.2970614.
4. M. N. Ashtiani and B. Raahemi, "Intelligent Fraud Detection in Financial Statements Using Machine Learning and
Data Mining: A Systematic Literature Review," in IEEE Access, vol. 10, pp. 72504-72525, 2022, doi:
10.1109/ACCESS.2021.3096799
5. Kotagiri, A. (2023). Mastering Fraudulent Schemes: A Unified Framework for AI-Driven US Banking Fraud
Detection and Prevention. International Transactions in Artificial Intelligence, 7(7), 1–19. Retrieved from
https://isjr.co.in/index.php/ITAI/article/view/197
6. Md Rokibul Hasan, Md Sumon Gazi, & Nisha Gurung. (2024). Explainable AI in Credit Card Fraud Detection:
Interpretable Models and Transparent Decision-making for Enhanced Trust and Compliance in the USA. Journal of
Computer Science and Technology Studies, 6(2), 01–12. https://doi.org/10.32996/jcsts.2024.6.2.1
7. Sabharwal, R., Miah, S.J., Wamba, S.F. et al. Extending application of explainable artificial intelligence for
managers in financial organizations. Ann Oper Res (2024). https://doi.org/10.1007/s10479-024-05825-9
8. Sai, Chaithanya Vamshi and Das, Debashish and Elmitwally, Nouh and Elezaj, Ogerta and Islam, Md Baharul,
Explainable Ai-Driven Financial Transaction Fraud Detection Using Machine Learning and Deep Neural Networks.
Available at SSRN: https://ssrn.com/abstract=4439980 or http://dx.doi.org/10.2139/ssrn.4439980
9. Raufi, B., Finnegan, C., Longo, L. (2024). A Comparative Analysis of SHAP, LIME, ANCHORS, and DICE for
Interpreting a Dense Neural Network in Credit Card Fraud Detection. In: Longo, L., Lapuschkin, S., Seifert, C. (eds)
Explainable Artificial Intelligence. xAI 2024. Communications in Computer and Information Science, vol 2156.
Springer, Cham. https://doi.org/10.1007/978-3-031-63803-9_20
10. Kennedy, R.K.L., Salekshahrezaee, Z., Villanustre, F. et al. Iterative cleaning and learning of big highly-imbalanced
fraud data using unsupervised learning. J Big Data 10, 106 (2023). https://doi.org/10.1186/s40537-023-00750-3
11. Chhabra, R., Goswami, S. & Ranjan, R.K. A voting ensemble machine learning based credit card fraud detection
using highly imbalance data. Multimed Tools Appl 83, 54729–54753 (2024).
https://doi.org/10.1007/s11042-023-17766-9
12. A. A. Taha and S. J. Malebary, "An Intelligent Approach to Credit Card Fraud Detection Using an Optimized Light
Gradient Boosting Machine," in IEEE Access, vol. 8, pp. 25579-25587, 2020, doi: 10.1109/ACCESS.2020.2971354.
13. Krishnavardhan, N., Govindarajan, M. & Rao, S.V.A. An intelligent credit card fraudulent activity detection using
hybrid deep learning algorithm. Multimed Tools Appl (2024). https://doi.org/10.1007/s11042-024-18793-w
14. Talaat, F.M., Aljadani, A., Badawy, M. et al. Toward interpretable credit scoring: integrating explainable artificial
intelligence with deep learning for credit card default prediction. Neural Comput & Applic 36, 4847–4865 (2024).
https://doi.org/10.1007/s00521-023-09232-2
15. T. Awosika, R. M. Shukla and B. Pranggono, "Transparency and Privacy: The Role of Explainable AI and Federated
Learning in Financial Fraud Detection," in IEEE Access, vol. 12, pp. 64551-64560, 2024, doi:
10.1109/ACCESS.2024.3394528.

You might also like