Machine learning · decision-making
A fraud model says how likely fraud is. This system decides what to do about it.
Data: Kaggle: Credit Card Transactions Fraud Detection Dataset · 1.85M card transactions, January 2019 to December 2020, generated with the Sparkov simulator.
Deployed on Render and Vercel.
Each card transaction is scored by a machine-learning model. A cost-based policy then picks one of three actions by comparing expected dollar losses, with only a limited number of analyst reviews per day:
- Approve let it through
- Review send to an analyst
- Block decline it
On three held-out months, it cost $12,762 against $37,964 for the usual approach of reviewing the highest-scoring cases: 66% less.
Key numbers
- card transactions over two years
- 1.85M
- of fraud caught by reviewing just 1% of transactions
- 93%
- lower total fraud cost than reviewing the highest-scoring cases
- 66%
- held out for the final test; every split and feature looks only at the past
- 3 months
How it works
- 1
A card transaction arrives
Amount, merchant category, time of day, and the card's recent history: how often it was used in the last hour and day, and how this amount compares with its usual spend.
- 2
The model scores it
A LightGBM model, trained only on earlier months, gives a calibrated fraud probability: a score of 30% means about 3 in 10 such transactions really are fraud.
- 3
The policy decides
It compares the expected dollar cost of each action and picks the cheapest. Analysts can only check 30 cases a day, so review slots go where they save the most money.
- 4
An analyst reviews
That's you. Open a case, read why it was flagged, and make the call. The app then reveals whether it was really fraud.
Why this matters
Fraud models are easy to train and hard to act on. Fraud is rare (about 1 in 190 transactions here), so a model that never flags anything is 99.5% accurate and useless. And analysts can only check a handful of cases a day, so the real question isn't “is this fraud?” but “which cases deserve a person's time?”
Ranking by probability alone wastes review slots on small purchases. Ranking by expected dollars, and blocking near-certain fraud outright, catches more of the money with fewer reviews.
The model scores transactions offline; this demo serves the precomputed results so it can run on free hosting. Full design decisions, tests and limitations are in the GitHub repository.