π³ Credit Card Fraud Detection β HF Space (Calibrated RF Model)
This is an interactive Gradio demo of a calibrated Random Forest model for credit card fraud detection.
The model was trained on the Kaggle Credit Card Fraud dataset,
and probability calibration ensures reliable decision thresholds for business scenarios.
π How to Use
Upload your CSV with transaction rows.
- Required columns:
V1β¦V28,Amount - Either include engineered features, or just add
Time(seconds from start)
β the app will automatically derive:_log_amountHour_from_start_mod24is_night_proxyis_business_hours_proxy
- Required columns:
Adjust the decision threshold with the slider.
- Default is set to the validation threshold for Precision β₯90% (
β0.712). - Move it left/right to trade off between precision and recall.
- Default is set to the validation threshold for Precision β₯90% (
Preview results (first 50 rows) or enable Return all rows for the full file.
- Each row includes:
Fraud_ProbabilityPrediction (0 = normal, 1 = fraud)
- Each row includes:
Download results as
predictions.csv.
π§ͺ Try with Example Data
You donβt need to bring your own data to test the app!
Just click Use Example inside the app, and it will load the included example_transactions.csv.
This file mimics the required structure:
- 60 transactions
- Columns:
V1..V28,Amount,Time - Probabilities + predictions are generated live with the same calibrated RF model.
π Notes
- The model is calibrated with Isotonic Regression for probability reliability.
- Default threshold corresponds to Precision β₯90%, aligning with fraud detection team priorities.
- For production use, re-tune thresholds regularly as data drift changes prevalence and costs.