EFPIP
Can a model catch the fraud an existing rule misses, and can we trust it?
5 min readJump to the recommendations →
- Problem
- The existing rule caught only 16 of 8,213 frauds in 6.36M payments.
- Result
- A Random Forest catches 85% of fraud with 78% precision, after I removed four leaking features that had inflated recall to 99%.
- Decision
- Monitor high-value TRANSFER and CASH_OUT payments now; pilot model scoring with risk-tier checks next.
The platform's existing rule was checked against 8,213 real frauds. What share do you think it caught?
Almost everything got through. That gap is why this project exists.
Fraud is rare, expensive, and the rule was almost blind.
One payment in every 775 is fraud, but each one costs an average of 1.46 million. The platform's existing rule flagged only 16 of the 8,213 frauds in the data. A payments company needs to know where fraud happens, catch it without blocking good customers, and explain every decision to an analyst.
- Payments
- 0
- Frauds
- 0
- Caught
- 0
- Missed
- 0
- False alarms
- 0
SQL first: find where fraud lives.
Before any model, I loaded all 6.36M rows into a SQL Server star schema (one fact table, five dimensions, row counts reconciled from raw to fact) and investigated with T-SQL.
All fraud sits in two transaction types.
TRANSFER and CASH_OUT carry 100% of the 8,213 frauds. Three types have none, so monitoring can start narrow.
Fraud has no quiet hour.
Frauds by period of the day are almost flat, so monitoring has to run around the clock.
99% recall looked perfect. That was the problem.
I trained three models (Logistic Regression, Random Forest, XGBoost) on an 80/20 split with SMOTE balancing on the training set. The first Random Forest caught 99.5% of frauds with 95.7% precision.
SHAP showed it leaned on four balance features. In PaySim, a fraudulent account's balance is often reset to zero whatever the amount: a quirk of the simulator, not real fraud behavior. The model was reading the answer, not learning fraud.
I removed them, retrained, and reported the lower numbers.
| Model | Precision | Recall | F1 | ROC-AUC |
|---|---|---|---|---|
| Logistic RegressionBaseline; far too many false alarms | 3.67% | 97.93% | 7.08% | 99.59% |
| Random Forest (original)Inflated by the simulator artifact | 95.72% | 99.45% | 97.55% | 99.88% |
| Random Forest, after leakage checkChampion, the numbers I report | 78.47% | 84.97% | 81.59% | 99.23% |
| XGBoostNot yet leakage-tested, so not reported as champion | 92.91% | 99.76% | 96.21% | 99.99% |
Which model would you ship?
Percentages hide the cost. Here is what each model does on the real test set: 1,272,524 payments, 1,643 of them fraud.
Of 1,643 frauds
Alerts your analysts review
Confusion matrix
The same model as a 2 × 2 grid: what really happened against what the model said.
| Model flags it | Model lets it pass | |
|---|---|---|
| Really fraud | caught | missed |
| Really legitimate | false alarms | correctly left alone |
Counts are derived from each model's reported precision and recall on the 1,643 test frauds, and they reproduce those metrics exactly (Logistic Regression's false alarms ±60 from rounding). Source: model evaluation results and the leakage-sensitivity notebook in the EFPIP repo.
Seven stages, from raw file to decision.
Three views, three audiences.
Executives see volume and fraud rate, risk analysts see where and when fraud happens, and the explainable-AI page shows why the model flags a payment. Click any screen to enlarge it.
Five recommendations, ranked by impact and effort.
North Star metric: fraud loss prevention, broken down in a KPI tree. Each recommendation was placed on an impact / effort grid so the team knows what to build first.
The number I'm proudest of is the lower one.
- PaySim is synthetic: no real identities, devices, geography or chargebacks.
- Authorization rate and customer experience are out of scope.
- XGBoost hasn't had the same leakage check yet.
- Run the leakage check on XGBoost.
- Validate on real, non-simulated transactions.
- Real-time scoring with drift monitoring.