GitHunt
MO

mohammadsiam2002/Fraud_detection

Detect financial fraud with ML-powered predictions via an interactive Streamlit app.

Fraud Detection System

**Overview

This project implements an intelligent machine learning–based system for detecting fraudulent financial transactions.
The system analyzes transaction details such as transaction type, amount, and account balances to automatically classify transactions as fraudulent or legitimate.
The project covers the complete machine learning pipeline, including:

Data analysis and preprocessing
Feature engineering
Model training and evaluation
Model persistence (saving/loading)
Deployment as a web application using Streamlit

**Objectives

Automatically detect fraudulent transactions in financial systems.
Reduce financial losses caused by fraud.
Apply machine learning techniques to real-world transaction data.
Provide a simple and interactive web interface for predictions.

**Dataset
Due to GitHub file size limits, the dataset is not stored in this repository.

You can download it from:
πŸ”— Dataset Link:
https://drive.google.com/file/d/1RcJRtQYILDjapaUG2okVZvq7i7x47EZA/view?usp=sharing

**Project Workflow

Dataset (CSV)
↓
Data Cleaning & Feature Engineering
↓
Preprocessing (Scaling & Encoding)
↓
Model Training (Logistic Regression)
↓
Model Evaluation
↓
Model Saved to Disk (.pkl)
↓
Streamlit Web App Loads Model
↓
User Inputs Transaction β†’ Prediction (Fraud / Not Fraud)

**Dataset Description

The dataset contains financial transaction records, where each row represents one transaction.

Main Features:
type β€”> Transaction type (TRANSFER, CASH_OUT, PAYMENT, etc.)
amount β€”> Transaction amount
oldbalanceOrg -> Sender balance before transaction
newbalanceOrig β€”> Sender balance after transaction
oldbalanceDest β€”> Receiver balance before transaction
newbalanceDest β€”> Receiver balance after transaction
isFraud β€”> Target label (1 = Fraud, 0 = Normal)

Engineered Features:

balanceDiffOrig = oldbalanceOrg βˆ’ newbalanceOrig

balanceDiffDest = newbalanceDest βˆ’ oldbalanceDest

**Machine Learning Model

Algorithm: Logistic Regression
Type: Supervised Binary Classification.
Preprocessing:
Numerical features scaled using StandardScaler.
Categorical features encoded using OneHotEncoder.
Full pipeline built using ColumnTransformer and Pipeline.

**Model Evaluation

The model is evaluated using:
Accuracy
Precision
Recall
F1-score
Confusion Matrix

**Web Application

#The trained model is deployed using Streamlit.
#The web app allows the user to:
1-Enter transaction details
2-Click Predict
Instantly see whether the transaction is:
βœ… Legitimate
❌ Fraudulent

**Technologies Used

Python
Pandas, NumPy
Scikit-learn
Matplotlib, Seaborn
Streamlit

**Project Structure

fraud-detection/
β”‚
β”œβ”€β”€ fraud_detection.py # Streamlit web application
β”œβ”€β”€ analysis_model.py # Model training and saving script
β”œβ”€β”€ fraud_detection_pipeline.pkl
β”œβ”€β”€ AIML Dataset (2).csv
└── README.md

Languages

Python100.0%

Contributors

Created January 11, 2026
Updated January 12, 2026
mohammadsiam2002/Fraud_detection | GitHunt