Skip to content

ML project detecting fraudulent credit card transactions using Logistic Regression, Random Forest, and XGBoost. Handles imbalanced data with SMOTE and comprehensive evaluation metrics.

Notifications You must be signed in to change notification settings

arshadmurtaza03/credit-card-fraud-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’³ Credit Card Fraud Detection Project

πŸ“– Project Overview

This project is an end-to-end machine learning model that detects fraudulent credit card transactions. I built this to practice data preprocessing, handling imbalanced data using SMOTE, and comparing the performance of different classification models like Logistic Regression, Random Forest, and XGBoost.

πŸ“Š Dataset

The project uses the "Credit Card Fraud Detection" dataset from Kaggle.

πŸš€ Features

  • Complete machine learning pipeline for fraud detection
  • Handles extreme class imbalance using appropriate evaluation metrics
  • Compares multiple algorithms: Logistic Regression, Random Forest, and XGBoost
  • Includes preprocessing, model training, and evaluation

πŸ“‚ Folder Structure

credit-card-fraud-detection/
β”œβ”€β”€ images/               # Visualizations 
β”œβ”€β”€ models/               # Trained models (.pkl files)
β”œβ”€β”€ notebooks/            # Jupyter notebook with full implementation
β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md            
└── requirements.txt      # Dependencies

πŸ› οΈ Setup and Installation

  1. Clone the repository:

    git clone https://github.com/arshadmurtaza03/credit-card-fraud-detection.git
    cd credit-card-fraud-detection
  2. Create and activate a virtual environment:

        # Linux/macOS
    python3 -m venv venv
    source venv/bin/activate
    
        # Windows
    python -m venv venv
    venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Download the dataset from the Kaggle link above and place it in the data/ directory.

  5. Run the Jupyter Notebook

    jupyter notebook notebooks/fraud_detection.ipynb

Usage

All the code and analysis can be found in the Jupyter Notebook inside the notebooks/ directory.


Model Evaluation Results

The models were evaluated based on their ability to correctly identify fraudulent transactions (Recall) while maintaining reasonable precision.

Model Precision (Fraud) Recall (Fraud) F1-Score (Fraud)
Logistic Regression 0.058 0.918 0.109
Random Forest 0.871 0.827 0.848
XGBoost 0.728 0.847 0.783

How to cite / contact

About

ML project detecting fraudulent credit card transactions using Logistic Regression, Random Forest, and XGBoost. Handles imbalanced data with SMOTE and comprehensive evaluation metrics.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published