Fraud-Detection-in-Financial-Transactions-EU

Fraud Detection in Financial Transactions by European Cardholders

GitHub issues License: MIT

πŸ“Œ Overview

This project presents a complete end-to-end system for detecting fraudulent financial transactions using Machine Learning. It integrates:

This solution demonstrates expertise in data preprocessing, model training (handling imbalanced data), API development, and Cloud deployment with AWS EC2 & Nginx.


πŸ“Š Features

πŸš€ Live Demo πŸ‘‰ http://hadi-fraud-detection.duckdns.org

βœ… Real Time Fraud Detection in Financial Transactions by European Cardholders

πŸ“œ Transaction History & Export

πŸ”’ Scalable & Secure Deployment


🧠 Problem Statement

The goal is to detect fraudulent transactions in a dataset of credit card transactions. Financial institutions can use this system to reduce fraud risk and improve their security systems.


Dataset Description

The project uses the Credit Card Fraud Detection dataset from Kaggle, which contains 284,807 credit card transactions, of which 492 are fraudulent. The dataset is highly imbalanced, and the features (V1 to V28) are anonymized, along with the transaction amount.


πŸ“Š Exploratory Data Analysis (EDA)


πŸ’» Modeling

Data Pipeline

Model Training

Why Random Forest?
Due to the extreme imbalance in the dataset, most models tend to favor the majority class. Random Forest, combined with SMOTE, provides a balanced approach between precision and recall. It achieves high accuracy while ensuring that the minority (fraud) class is adequately represented.


βœ… Evaluation

The best model was evaluated on the test data, and the following results were obtained

πŸš€ Deployment

FastAPI API

Streamlit Application


βš™οΈ Installation and Usage

Prerequisites

Installation

  1. Clone the Repository
    git clone https://github.com/HadirouTamdamba/Fraud-Detection-in-Financial-Transactions-EU.git
    cd Fraud-Detection-in-Financial-Transactions-EU
    
  2. Install Dependencies
    pip install -r requirements.txt
    
  3. Running the Streamlit Application

    Navigate to the Streamlit Directory

    cd frontend_streamlit
    

Contributing

Contributions are welcome! Please follow these steps:

  1. Clone the project.
  2. Create a new branch (feature/new-feature).
  3. Commit your changes (git commit -m β€˜Add new feature’).
  4. Push the branch (git push origin feature/new-feature).
  5. Open a Pull Request.

πŸ“Š Conclusion

The Random Forest Classifier combined with SMOTE has proven highly effective for tackling the imbalanced fraud detection problem.

βœ… Recall score ~0.84 for fraudulent transactions
βœ… Robust detection of fraudulent activities
βœ… Scalable & efficient deployment on AWS Lambda & EC2

βœ… Real-time fraud probability calculation

βœ… Complete transaction history tracking & export functionality

The deployment of the FastAPI backend on AWS Lambda, Render and the Streamlit web app on AWS EC2 showcases a robust and scalable end-to-end solution. This project highlights advanced skills in Machine Learning, API development, and Cloud Computing.


βš™οΈ Tech Stack

βœ”οΈ Random Forest Model for fraud detection
βœ”οΈ FastAPI (AWS Lambda) for backend inference
βœ”οΈ Streamlit for interactive UI
βœ”οΈ AWS EC2 & Nginx for cloud deployment
βœ”οΈ Transaction history tracking & CSV export


Acknowledgments

We extend our sincere gratitude to the European financial institutions and data providers that facilitated the collection of transactional data for this project. Their valuable contributions have been instrumental in advancing fraud detection research and enhancing financial security.

A special thanks to all Stakeholders, Researchers, and Contributors who have supported this initiative to make digital transactions safer and more secure for everyone.


πŸ‘¨β€πŸ’» About the Author

Hadirou Tamdamba
AI Engineer Data Scientist Associate | Machine Learning Engineer

πŸ”— LinkedIn: Hadirou Tamdamba
πŸ”— GitHub: HadirouTamdamba
πŸ“§ Email: hadirou.tamdamba@outlook.fr


πŸ“’ Feel free to explore, contribute, or provide feedback!
πŸš€ Let’s make digital transactions more secure together!