---
title: "Death Legion Fraud Detection"
emoji: "🔥"
colorFrom: "red"
colorTo: "red"
sdk: "gradio"
sdk_version: "4.19.0"
python_version: "3.10"
app_file: "app.py"
pinned: false
---
# 🔥 Death Legion Fraud Detection System
## 🎯 Overview
Welcome to the **Death Legion Fraud Detection System** - a state-of-the-art machine learning solution for real-time credit card fraud detection. Built by the **Best Teams** with cutting-edge Random Forest technology, this model achieves exceptional performance on highly imbalanced financial datasets.
## 🚀 Deploy This Space
## 🎮 Use This Model
## ⚡ Key Features
- **🛡️ Advanced Random Forest Architecture**: 500 estimators with optimized depth
- **📊 Superior Performance**: AUPRC 0.8177 on imbalanced fraud data
- **🔒 Secure Safetensors Format**: Fast, safe model serialization
- **⚡ Real-time Inference**: Sub-millisecond prediction latency
- **🎯 Imbalanced Data Optimized**: Precision-Recall focused evaluation
## 📈 Performance Metrics
| Metric | Score | Status |
|--------|-------|--------|
| **AUPRC** | 0.8177 | ✅ Excellent |
| **Precision** | 0.8182 | ✅ High |
| **Recall** | 0.8265 | ✅ Strong |
| **F1-Score** | 0.8223 | ✅ Balanced |
## 🏗️ Model Architecture
```
Random Forest Classifier
├── Estimators: 500
├── Max Depth: 25
├── Features: 30 (V1-V28 + Time + Amount)
├── Classes: 2 (Legitimate, Fraudulent)
└── Format: Safetensors (6.12 MB)
```
## 📖 How to Use
### Quick Start
1. **Access the Live Demo**: Visit [https://huggingface.co/spaces/Pnny13/fraud-detection-space](https://huggingface.co/spaces/Pnny13/fraud-detection-space)
2. **Enter Transaction Features**: Input the 30 features (V1-V28, Time, Amount) from your credit card transaction
3. **Get Instant Prediction**: The system will return:
- Fraud probability score (0-100%)
- Binary classification (Fraud/Legitimate)
- Recommendation for action
### Programmatic Usage
```python
from safetensors.numpy import load_file
import numpy as np
# Load model from Hugging Face Hub
from huggingface_hub import hf_hub_download
model_path = hf_hub_download(
repo_id="Pnny13/fraud-detection-model",
filename="fraud_detector.safetensors"
)
# Load and predict
tensors = load_file(model_path)
# ... use model for predictions
```
## 📁 Repository Structure
```
Pnny13/fraud-detection-space/
├── app.py # Gradio application
├── requirements.txt # Python dependencies
└── README.md # Documentation
Pnny13/fraud-detection-model/
├── fraud_detector.safetensors # Trained model
├── scaler.joblib # Feature scaler
├── inference.py # Prediction script
└── README.md # Model documentation
```
## 🔬 Technical Details
### Dataset
- **Source**: [Kaggle - Credit Card Fraud Detection](https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud)
- **Transactions**: 284,807 total
- **Fraud Cases**: 492 (0.172% - highly imbalanced)
- **Features**: 30 PCA-transformed features + Time + Amount
### Preprocessing
- **Robust Scaling**: Applied to Time and Amount features
- **Feature Engineering**: PCA components V1-V28
- **Class Balancing**: Optimized for precision-recall tradeoff
### Training Configuration
```python
RandomForestClassifier(
n_estimators=500,
max_depth=25,
class_weight='balanced_subsample',
random_state=42,
n_jobs=-1
)
```
## 🎮 Live Demo
Try the live interactive demo at: **https://huggingface.co/spaces/Pnny13/fraud-detection-space**
## 🤝 Credits
Powered by Death Legion
Elite Machine Learning Division
Best Teams Collaboration
Excellence in AI Engineering
## 📜 License
This model is released under the MIT License. Use responsibly for fraud detection and financial security applications.
## 🔗 Links
- 🤗 Model: https://huggingface.co/Pnny13/fraud-detection-model
- 🚀 Space: https://huggingface.co/spaces/Pnny13/fraud-detection-space
- 📊 Dataset: https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud
Built with 🔥 by Death Legion | Best Teams Elite Division