# FraudShield: AI-Driven Fraud & Anomaly Detection System

A machine learning application that detects fraudulent credit card transactions. Users can input transaction details and instantly receive a fraud risk prediction with visualized anomaly indicators.

## Overview

Dataset: [Kaggle Credit Card Fraud Detection](https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud) 
Models: Logistic Regression, Random Forest, Anomaly Detection (Isolation Forest) 
Backend: FastAPI 
Frontend: HTML / CSS / JavaScript

## Project Structure

```
fraudshield/
├── data/
│   └── creditcard.csv
├── notebooks/
│   ├── 01_data_prep.ipynb
│   ├── 02_baseline_models.ipynb
│   └── 03_advanced_models.ipynb
├── models/
├── backend/
│   ├── main.py
│   ├── model_loader.py
│   └── schemas.py
├── frontend/
│   ├── index.html
│   ├── style.css
│   └── app.js
├── requirements.txt
└── .gitignore
```

## Setup

Clone the repo:
```bash
git clone https://github.com/YOUR_USERNAME/fraudshield.git
cd fraudshield
```

Create a virtual environment:
```bash
python -m venv venv
source venv/bin/activate
venv\Scripts\activate
```

Install dependencies:
```bash
pip install -r requirements.txt
```

Download the dataset from https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud and place creditcard.csv in the data/ folder.

Run the backend:
```bash
cd backend
uvicorn main:app --reload
```

Open frontend/index.html in a browser.


## Success Metrics

- ROC-AUC of 0.95 or higher
- Precision of 0.85 or higher on the fraud class
- Recall of 0.80 or higher on the fraud class
- API response time under 500ms

## Branching

See BRANCHES.md for the full branching strategy.

## License

MIT
