ML for Factor Investing (Book Series)
Nine-lesson video walkthrough of Coqueret & Guida's Machine Learning for Factor Investing: the 1,207-stock US equity dataset, classic factors and the replication crisis, preprocessing, ridge/lasso, trees, neural nets, validation, backtesting, interpretability, causality, and RL.
Overview
Guillaume Coqueret and Tony Guida's Machine Learning for Factor Investing: Python Version (CRC Press, 2023) applies modern machine learning to cross-sectional equity factor investing on one transparent US equity dataset. Its premise is modest: future stock returns depend on firm characteristics through an unknown, potentially nonlinear, time-varying relationship, and simple benchmarks plus honest validation matter more than algorithmic sophistication. Sophie's video series covers Chapters 1–17 in nine lessons (~95 minutes total).
Lesson Roadmap
| # | Chapters | Focus |
|---|---|---|
| 1 | Ch 1–2, §3.1–3.2, Ch 17 | Dataset, ML portfolio workflow, "ML is no magic wand", portfolio sorts, classic factors, Fama-MacBeth, factor competition |
| 2 | §3.3–3.5 + Ch 4 | Factors vs characteristics, factor momentum/timing/ESG, preprocessing: missing data, outliers, scaling, labelling, persistence |
| 3 | Ch 5 + Ch 9 | Ridge, lasso, elastic net, sparse hedging for minimum-variance portfolios; Bayesian priors, MCMC, Bayesian regression, naive Bayes, BART |
| 4 | Ch 6 + Ch 8 | Simple trees, random forests, AdaBoost, XGBoost (monotonicity, DART), BART, and SVMs |
| 5 | Ch 7 | Neural networks: perceptron, MLP, universal approximation, back-prop, depth vs sample size, dropout, LSTMs/GRUs, autoencoders, GANs |
| 6 | Ch 10 | Validating and tuning: regression/classification metrics, ROC/AUC, bias–variance trade-off, grid/random/Bayesian search, purged CV |
| 7 | Ch 11–12 | Ensembles and portfolio backtesting: signals to weights, performance metrics, common errors, non-stationarity, backtest overfitting |
| 8 | Ch 13–14 | Interpretability (surrogates, variable importance, PDP, LIME, Shapley), causality (Granger vs Pearl), covariate shift and concept drift |
| 9 | Ch 15–16 | Unsupervised learning (PCA, autoencoders, k-means, kNN), reinforcement learning (Q-learning, policy gradients), series wrap-up |
Lesson 1: Foundation (Ch 1–2, §3.1–3.2, Ch 17)
- Shared dataset. 1,207 US-listed stocks sampled monthly (283,380 full rows Nov 1998–Mar 2019; 268,336 filtered 2000–2018 rows), 93 cross-sectionally uniformized features across valuation, quality, momentum, risk, earnings estimates, and liquidity, with 1-, 3-, 6-, and 12-month forward return labels.
- ML is no magic wand. Financial returns are noisy, easy anomalies get arbitraged away, and by the no-free-lunch theorem, inputs and framing matter more than model complexity.
- Classic factors & testing. Portfolio sorts, long-short factors (SMB, HML, WML, RMW, CMA, BAB), two-pass Fama-MacBeth regressions, and factor competition (showing HML becomes redundant in Fama-French 2015 once RMW and CMA are included).
- Replication crisis. Post-publication decay and ETF crowding (McLean & Pontiff), Harvey's higher t-statistic bar (
t > 3), and ~12% publication-bias haircut (an 8% reported return is closer to ~7%).
Key Concepts
- Uniformization — ranking each feature cross-sectionally on every date and mapping it evenly onto
[0, 1]to control outliers and cross-date drift. - Asset pricing anomaly — a firm characteristic or long-short factor that explains cross-sectional returns beyond CAPM market beta.
- Fama-MacBeth regression — two-pass estimation: time-series regressions estimate stock betas, then date-by-date cross-sectional regressions estimate factor risk premia.
- No-free-lunch theorem — no single ML algorithm dominates across all problems; data quality and problem design dominate architecture tweaks.
Formulas
Key Takeaways
- Standardize features cross-sectionally at each date and label relative to the date's median so classes stay balanced across market regimes.
- Evaluate every ML model against simple benchmarks and higher statistical hurdles (
t > 3) to guard against data snooping and publication bias. - The ML portfolio workflow is an intertwined feedback loop from data processing through transaction-cost-aware backtesting.
Related Reading
Machine Learning for Factor Investing: A 9-Lesson Video Series on Coqueret & Guida
Coqueret & Guida's Machine Learning for Factor Investing in nine short lessons: factors, preprocessing, ridge/lasso, trees, neural nets, validation, backtesting, interpretability, and RL.