series
Financial machine learning from zero
A beginner-friendly series on machine learning in finance, built around the problems banks actually run models on: credit scoring, fraud detection, and anti-money-laundering analytics, with market prediction as a supporting track. Every part with code comes with runnable companion code. No GPU needed.
- for
- People who know some Python and have never trained a model on financial data.
- published
- 4 parts · 88 min of reading
- planned
- 3 more
- code
- github.com/prashant-fintech/financial-ml-from-zero ↗
parts
- 01
The vocabulary, the traps, and the metrics that matter
The first post in a beginner-friendly series on machine learning in finance, built around the problems banks actually run models on: credit scoring, fraud detection, and anti-money-laundering analytics, with market prediction as a supporting track. No code yet. Instead, the things I wish every newcomer knew before training a model on financial data: why it breaks the textbook assumptions, the vocabulary in every model notebook, the mistakes that make models look brilliant in development and fail in production, and a reference table of the metrics that matter, with which direction is good for each.
22 min readcode ↗
- 02
Tensors, time-ordered batching, and why leakage hides in .shift()
The second post in the financial machine learning series, and the first with code. It turns a Freddie Mac-style mortgage panel into PyTorch tensors one named step at a time, then breaks the pipeline on purpose with eight one-line mistakes and measures each one. Some push validation PR-AUC from 0.31 to 0.96. Others barely move it, which is worse, because nothing looks wrong. It ends with the checks that catch every one of them before a reviewer does.
27 min readcode ↗
- 03
A probability-of-default baseline you can trust
The third post in the financial machine learning series turns part 2's tensors into a complete probability-of-default baseline. Two simple benchmarks, logistic regression in PyTorch, the probability trap inside class-weighted loss, calibration curves, and a review threshold frozen before the test period is scored. Every result comes from the runnable companion code, on the same synthetic mortgage panel.
20 min readcode ↗
- 04
Purged walk-forward validation
A date split is not enough when each mortgage label looks twelve months ahead. Part 4 builds a purged walk-forward schedule, separates label maturity from reporting delay and embargo, and gives calibration and policy selection their own place in time. A runnable calendar audit checks the boundaries, including the ones that fail without changing a model's score.
19 min readcode ↗
- ··
Fraud detection with late-arriving labelsplanned
Training and evaluating when a fraud label only exists once a customer notices and disputes.
- ··
The anomaly layer of an AML pipelineplanned
How to measure it when almost nothing is labelled.
- ··
A short market trackplanned
A return-prediction baseline, and the ranking and strategy metrics applied honestly.
Follow new parts via RSS.