Detective.AI is a machine learning-powered web application that detects fraudulent transactions in real-time. Trained on the IEEE-CIS Fraud Detection dataset, this app leverages XGBoost, SMOTE, and Streamlit to deliver fast and reliable predictions based on transaction data.
- Predicts fraudulent vs legitimate transactions
- User-friendly Streamlit interface
- XGBoost model with SMOTE to handle class imbalance
- Custom preprocessing pipeline (label encoding, scaling)
- Interactive form inputs for simulation
| Component | Description |
|---|---|
| Model | XGBoost Classifier |
| Preprocessing | SMOTE Oversampling, Label Encoding |
| Input Features | TransactionAmt, card1, card2, addr1, addr2, P_emaildomain, ProductCD_W, card4_visa, card6_credit, M6_T, etc. |
| Target Variable | isFraud (Binary Classification) |
Detective.AI/
│
├── models/ # All serialized ML assets
│ ├── fraud_detection_model.joblib
│ ├── model_columns.joblib
│ └── email_encoder.joblib
│
├── app.py # Main Streamlit app
├── requirements.txt # Project dependencies
└── README.md # You're reading it
| Class | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| 0 (Legitimate) | 0.98 | 0.98 | 0.98 | 113,952 |
| 1 (Fraudulent) | 0.54 | 0.54 | 0.54 | 4,154 |
| Accuracy | 0.97 | 118,106 | ||
| Macro Avg | 0.76 | 0.76 | 0.76 | 118,106 |
| Weighted Avg | 0.97 | 0.97 | 0.97 | 118,106 |
🚨 Note: While the model achieves high overall accuracy, the recall for fraudulent transactions (class
1) is moderate. This is expected due to the imbalanced nature of the dataset. Techniques like SMOTE have been applied to mitigate this.