Machine learning project for credit card fraud detection. We explored why accuracy is a terrible metric for imbalanced datasets and tested different approaches to actually catch frauds.
The credit card dataset has 284,807 transactions but only 0.17% are frauds. This creates a nasty problem: a dumb model that just says "not fraud" for everything still gets 99.83% accuracy. Sounds great until you realize it catches zero frauds.
We dug into this problem and tested several solutions.
| Model | Accuracy | Recall | What It Means |
|---|---|---|---|
| "Always Not Fraud" | 99.83% | 0% | Useless |
| Random Forest (regular) | ~99.9% | ~76% | Decent |
| Random Forest + SMOTE | ~99.9% | ~92% | Best |
TL;DR: Forget accuracy. Look at recall, precision, F1, and AUPRC for fraud detection.
git clone https://github.com/MrMuscleFreak/Fraud-Detection-Project.git
cd Fraud-Detection-Project
python -m venv venv
venv\Scripts\activate # Windows
python setup_project.py
jupyter notebookDownload the dataset from Kaggle and drop it in the data/ folder.
- 01 - Data overview and why accuracy is misleading
- 02 - Baseline models (majority class, random guess, amount threshold)
- 03 - Balancing strategies (undersampling, oversampling, SMOTE)
- 04 - Random Forest with full evaluation dashboard
Check out project_report.md for the full writeup.