Machine Learning
Classical ML in practice: credit scoring, fraud detection, feature engineering, and evaluation.
2026
BankruptSense: predicting corporate bankruptcy when a miss costs ten false alarms
A case study of BankruptSense, an early-warning model that ranks 6,819 Taiwanese companies by bankruptcy risk from 95 financial ratios. Why accuracy is useless at a 30 : 1 imbalance, the best feature that a correlation screen ranked 58th, why the 'dirty' rows were kept, how the threshold was chosen from a 10 : 1 cost, and the nine bankruptcies the model never saw coming. Slide deck included.
8 min read
AI in Financial Risk, Part 2: Machine Learning versus Statistical Models
The second part of the series puts one risk question, will the S&P 500 lose more than 1% tomorrow, through both ways of working. As a statistical model, a logistic regression finds one significant coefficient, and block-bootstrap standard errors double the uncertainty on another. As a prediction, the same model beats the base rate by 0.7% on held-out days, and a nearest-neighbour model that is perfect on its training data is 81% worse. A simulated market with a known truth splits the error into bias and variance, and a 10 to 1 cost on missed losses shows a rule with 89% accuracy to be the most expensive one on the table.
20 min read
AI in Financial Risk, Part 1: Financial Data and Its Distributions
The first part of a series on where machine learning and LLMs change risk work. Before any model, ten years of daily S&P 500 closes go through one inspectable step at a time: prices become returns, the returns are compared with a normal distribution of the same mean and volatility, and the gaps are counted. There are 36 days beyond three standard deviations where the normal expects about 7, a one-day 99% cut-off breached 51 times instead of 25, and volatility that clusters in a way the normal says it cannot. Removing 2020 makes the tails thinner, not normal.
16 min read
Financial machine learning from zero, part 4: 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 read
Financial machine learning from zero, part 3: 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 read
Financial machine learning from zero, part 2: 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 read
Financial machine learning from zero, part 1: 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 read