7Course 7Machine learning & AIAdvanced
Machine Learning for Fraud Detection
Build, evaluate, and deploy a fraud model that beats your rules, and know when it does not.
- Chapters
- 12
- Time
- 12 hours
- Format
- Self-paced
- Tools
- Python, pandas, scikit-learn, LightGBM or XGBoost; notebooks and dataset provided
What you will be able to do
- Frame fraud detection as a supervised problem and understand why the label is the hardest part.
- Engineer velocity, aggregation, and behavioural features that models can actually use in real time.
- Train gradient-boosted models on imbalanced data and evaluate with precision-recall, not accuracy.
- Pick a threshold based on the cost of a missed fraud and the cost of a blocked customer.
- Explain individual decisions, monitor drift, and set a retraining policy.
Chapters
12 chapters. Chapter 2 is free below.
- 1
Rules versus models
What a model adds, what it costs, and how the two work together.
- 2
LabelsFree to read
Chargebacks arrive late, confirmed fraud is a sample, and the label leaks. Handling each.
- 3
Train, validate, test in time
Why random splits lie in fraud and how to split by date.
- 4
Feature engineering
Velocity windows, entity aggregates, time since events, and what can be computed at decision time.
- 5
Imbalanced data
Class weights, sampling, and why accuracy is meaningless when fraud is one percent.
- 6
Gradient-boosted trees
Training LightGBM or XGBoost, tuning the few parameters that matter.
- 7
Evaluation
Precision-recall curves, recall at fixed false positive rate, and dollar-weighted metrics.
- 8
Choosing a threshold
Costing a missed fraud and a false decline, and turning that into a cut-off.
- 9
Explainability
SHAP values for one decision, and reason codes a reviewer can read.
- 10
Deployment shapes
Batch scoring, real-time scoring, shadow mode, and the fallback when the model is down.
- 11
Monitoring and drift
Score distributions, feature drift, label lag, and when to retrain.
- 12
Capstone: from rules to a shadow-mode model
Build, evaluate against the rules from Fraud Analytics, and write the go-live recommendation.
Free chapter 2 of 12
Labels
A fraud model learns from examples of fraud, and the examples are worse than they look. A chargeback arrives 30 to 120 days after the transaction, so the most recent months of data have almost no fraud labels, not because there was no fraud but because it has not been reported yet. Train on last month and the model learns that recent transactions are safe.
Confirmed fraud is also a sample. Your team only investigated what the rules flagged, so labelled fraud looks like what the rules already catch. Fraud that slipped through is labelled 'good'. A model trained on this learns to imitate the rules and gets credit for it in evaluation, while missing exactly the cases you wanted it for.
Then there is leakage. A feature like 'account status' might be set to 'blocked' after the fraud was found, so it perfectly predicts the label in training and is useless at decision time, when the account was still active. Every feature has to be asked one question: what value did this have at the moment we would have scored the transaction?
None of this makes modelling pointless. It means the first week of a fraud modelling project is spent on labels, not algorithms: defining a label maturity window, keeping a holdout of transactions that bypass rules so you can measure what the rules miss, and building features from point-in-time data. This chapter shows how to do each on the course dataset.
Who it is for
Analysts and engineers on risk teams who have rules in production and want a model that improves on them without becoming a black box nobody trusts.
Before you start
Python for Data Analysis and Fraud Analytics, or equivalent experience with pandas and transaction data. No prior machine learning.
Taught by
Paul Montero
Founder and instructor
Questions about this course
How long do I have access?
Is the dataset included?
Can I get a refund?
incl. GST, 7-day refund