fraud-detection-calibrated / README_space.md
tarekmasryo's picture
Upload README_space.md
5d7796c verified
|
raw
history blame
2.1 kB

πŸ’³ 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

  1. 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_amount
      • Hour_from_start_mod24
      • is_night_proxy
      • is_business_hours_proxy
  2. 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.
  3. Preview results (first 50 rows) or enable Return all rows for the full file.

    • Each row includes:
      • Fraud_Probability
      • Prediction (0 = normal, 1 = fraud)
  4. 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.

πŸ”— Related