Fraud Detection

Live demo · real public dataset · nothing calls a model

Fraud Detection.

A fraud model built to UK bank model-validation practice, with a plain-English reason for every declined payment.

The score is not the interesting part. The judgement calls are: why the leaderboard winner was not chosen, where the cost-optimal threshold broke on later data, and what the explanations can and cannot tell a customer.

Every figure below is read from the pipeline's own output files. For the full interactive version, open the Streamlit dashboard ↗ (it can take about 30 seconds to wake).

At a glance · out-of-time test set · deployment threshold

Fraud caught of
Alert precision of alerts are real fraud
Alerts per 10,000 transactions sent to review
KS / AUPRC / ranking quality

01 · Score a transaction

One payment, one decision, one reason

Each sample is a real transaction from the final, out-of-time test window, which the model never saw in training. Its score and SHAP values were computed once, with the same code the API runs; this page replays them.

Fraud probability

Why

SHAP contribution · log-odds

Toward fraud — may be cited as a reason Away from fraud — never cited

What the customer receives

Want to change the amount or time of day and watch it flip? Open the dashboard ↗

02 · Threshold & cost

Where to draw the line

A missed fraud and a false alarm do not cost the same, so the threshold is set by expected cost, not F1. It was chosen on the validate set and then frozen before the test set was scored.

Fraud caught
False alarms
Total cost
Total cost vs threshold — champion XGBoost (threshold grid is log-spaced)

The two thresholds, frozen

ThresholdSetFraud caughtPrecisionCost

Stated honestly

03 · Champion

The leaderboard is not the decision

Three models trained under identical out-of-time conditions. On the test set, Random Forest ranks best — the table shows it.

ModelValidateTest
KSAUPRCF1KSAUPRCF1

Bold = best in column

Then apply the deployment threshold.

Alert precision — share of alerts that are fraud

Share of all transactions flagged

    04 · Drift & monitoring

    What a monitor should catch

    Each split is a later slice of time, so differences between them are real temporal shift.

    Population Stability Index · train vs test · eight most influential features

    Dashed lines: 0.10 moderate · 0.25 significant shift

    Retraining trigger · Airflow drift_check

    Hourly fraud rate across the -hour window · split periods shaded

    05 · The full dashboard

    Explore it yourself

    • Score a Transaction Edit amount, time of day and the top risk indicators, and watch the decision change.
    • Threshold & Cost The same cost trade-off, with the full curves.
    • Drift and Champion Rationale PSI, KS curves, calibration and feature importance.

    Real public dataset (anonymised card transactions) · nothing you do calls a paid service.