13 tutorials· Ordered reading path
Finance provides some of the richest and most challenging data for machine learning. This path covers methods used by quant researchers: detecting market regimes, building trading strategies, and modelling risk.
You will implement changepoint detection, test for cointegration, build Markowitz portfolios, fit hidden Markov models to market data, and apply survival analysis to real-world outcomes.
Detect volatility regime shifts in the S&P 500 with the PELT algorithm. Compare PELT vs Binary Segmentation and align changepoints with financial crises.
Detect regime shifts in real time with BOCD. Track posterior probabilities on S&P 500 data, choose your detection threshold, and compare with offline PELT.
Run a Bayesian changepoint detector across S&P 500, oil, gold, EM equities, and the dollar. 22 years, 69 detections: 47 genuine, 10 plausible, 12 tenuous.
Test cointegration between ETF pairs using Engle-Granger and Johansen methods in Python. Build a pairs trading strategy with z-score signals on real data.
Fit a GARCH model in Python with NumPy and SciPy, verify it against arch, and compare volatility forecasts with EWMA on pinned S&P 500 returns.
Build the Markowitz efficient frontier in Python with matrix algebra and Monte Carlo. Optimal portfolios, the Sharpe ratio, and the capital market line.
Implement the Kelly criterion in Python. Simulate uncertain returns, compare fractional Kelly and inspect a GARCH allocation with explicit costs.
Hidden Markov Models via the weather-umbrella analogy. Forward and Viterbi algorithms from scratch, stock market regime detection, and HMM vs K-Means.
Reconstruct a chaotic attractor from a single time series with Takens delay embedding, then forecast it with simplex projection, from scratch in NumPy.
Build an LSTM from scratch, check the NumPy cell against PyTorch and measure how forget bias changes recall across 100 sequence steps.
Fit Cox proportional hazards in Python on real recidivism data: partial likelihood, hazard ratios, Schoenfeld diagnostics, and time-dependent covariates.
Bayesian accelerated failure time model in PyMC for customer churn. Censored data with pm.Potential, Weibull vs Log-Logistic, and ArviZ survival curves.
Build a Metropolis-Hastings sampler from scratch to infer hidden regimes in earthquake data. Full posterior distributions instead of point estimates.
Option pricing calculator with all Greeks (delta, gamma, theta, vega, rho). Interactive parameter sliders with real-time payoff and sensitivity charts.
Try itCalculate optimal bet sizing with the Kelly criterion. Growth rate curves, fractional Kelly strategies, and risk of ruin analysis.
Try itPortfolio risk analysis: maximum drawdown, Sharpe/Sortino/Calmar ratios, VaR, CVaR. Paste returns data and get instant equity curve and risk metrics.
Try itGet notified when new tutorials and deep-dives are published. No spam, unsubscribe anytime.
Common questions about this topic