Advances in Financial Machine Learning: a map of the techniques and the tools that implement them
Marcos López de Prado's Advances in Financial Machine Learning, published by Wiley in 2018, became a reference for researchers applying machine learning to markets. Its value lies less in any single algorithm than in a systematic account of why standard methods fail on financial data and what to do instead. This article maps the book's structure, highlights the techniques most widely adopted, and describes how software implementations have developed.
Why the book mattered
Before 2018, much machine-learning work in finance borrowed methods from image recognition or text processing with little adaptation. The book argued that financial data break the assumptions of those methods: they are non-stationary, have a low signal-to-noise ratio, and produce overlapping, dependent observations. It also argued that most published backtests are overfitted because researchers try many variations and report the best one. The book's techniques are organised to address those problems one by one.
Part 1: data analysis
- Financial data structures (ch. 2): tick, volume and dollar bars, and imbalance and run bars, as alternatives to time bars. Also covers how to roll futures contracts into continuous series.
- Labelling (ch. 3): the triple-barrier method and meta-labelling, which we explain in our toy example.
- Sample weights (ch. 4): uniqueness of overlapping labels, sequential bootstrap and time-decay weights.
- Fractionally differentiated features (ch. 5): covered in our article on fractional differentiation.
Part 2: modelling
- Ensemble methods (ch. 6): why bagging suits noisy financial data and how to adapt random forests to overlapping samples.
- Cross-validation in finance (ch. 7): purged k-fold cross-validation with an embargo.
- Feature importance (ch. 8): mean decrease impurity, mean decrease accuracy and single feature importance, plus orthogonal features to deal with substitution effects.
- Hyper-parameter tuning (ch. 9): grid and randomised search with purged cross-validation, and scoring by log loss rather than accuracy.
Part 3: backtesting
- Bet sizing (ch. 10): converting predicted probabilities into position sizes.
- The dangers of backtesting (ch. 11): the main sources of false discoveries, including selection bias under multiple testing.
- Backtesting through cross-validation (ch. 12): combinatorial purged cross-validation, which produces many backtest paths rather than one.
- Backtesting on synthetic data (ch. 13): calibrating trading rules on simulated price paths, for example from an Ornstein-Uhlenbeck process.
- Backtest statistics (ch. 14): measures such as the probabilistic and deflated Sharpe ratios, drawdown and time under water.
- Understanding strategy risk (ch. 15): the relationship between precision, betting frequency and the probability of a strategy failing.
- Machine learning asset allocation (ch. 16): hierarchical risk parity.
Parts 4 and 5: features and computing
Part 4 covers useful financial features: structural break tests (ch. 17), entropy measures (ch. 18) and market microstructure features such as order-flow imbalance and the VPIN measure of flow toxicity (ch. 19). Part 5 covers high-performance computing: multiprocessing and vectorisation (ch. 20), brute-force and quantum combinatorial optimisation (ch. 21), and high-performance computational intelligence (ch. 22, written with contributors from Lawrence Berkeley National Laboratory).
The ideas that travelled furthest
Judging by how often they appear in later research and in practitioner tools, a handful of the book's ideas have been especially influential:
- Purged cross-validation, now a common requirement for any machine-learning study on overlapping financial labels.
- Triple-barrier labels and meta-labelling, which gave researchers a practical way to define targets and to separate side from size.
- The deflated Sharpe ratio, from earlier work with David Bailey, which made multiple testing a standard part of backtest reporting.
- Hierarchical risk parity, introduced in a 2016 Journal of Portfolio Management paper. It clusters assets by correlation, orders the covariance matrix along the resulting tree, and allocates risk recursively between clusters. Because it never inverts the covariance matrix, it avoids much of the instability of mean-variance optimisation discussed in our article on portfolio weights.
How implementations evolved
The book contains many short Python code snippets, but not a packaged library. After publication, several open-source projects set out to turn the snippets into tested, documented code. The best known, mlfinlab, was released on the Python Package Index from 2019 and attracted a large user base before its maintainers moved it to a commercial licence; we tell that story in mlfinlab on the PyPI index. Other community projects have reimplemented parts of the book under open licences, and individual techniques, such as purged cross-validation or hierarchical risk parity, are available in general-purpose portfolio and machine-learning libraries.
When choosing an implementation, a few checks are worthwhile: whether it has unit tests that reproduce the book's examples; whether its licence fits your use; whether it is still maintained; and whether its functions handle edge cases such as missing data and overlapping events correctly. Implementing a technique yourself from the book and the original papers remains the best way to understand it, and a useful cross-check on any library.
A companion volume
López de Prado's shorter Machine Learning for Asset Managers (Cambridge University Press, 2020) revisits several themes, including denoising covariance matrices, distance metrics, clustering, and the nested clustered optimisation algorithm, in a more compact form. Readers who find the 2018 book dense often start there.
How to read the book
The chapters are not equally accessible. Readers new to the material often find it easiest to start with chapters 2 to 5 on data and labels, which are concrete and can be implemented quickly on freely available data, then move to chapter 7 on cross-validation and chapters 11 to 14 on backtesting, which change how one judges any strategy. The chapters on high-performance computing can be skipped on a first reading. Each chapter ends with exercises; working through a selection of them, and checking results against the original papers cited in the references, is a better use of time than reading the whole book passively. Some readers also find it useful to keep a notebook that implements each technique on the same small dataset, so that the effect of every step, from bar construction to labelling to validation, can be seen in sequence.
Sources
- López de Prado, M. (2018). Advances in Financial Machine Learning. Wiley.
- López de Prado, M. (2016). Building Diversified Portfolios that Outperform Out of Sample. Journal of Portfolio Management, 42(4), 59–69.
- López de Prado, M. (2020). Machine Learning for Asset Managers. Cambridge University Press (Elements in Quantitative Finance).
- Bailey, D. and López de Prado, M. (2014). The Deflated Sharpe Ratio. Journal of Portfolio Management, 40(5), 94–107.
- Easley, D., López de Prado, M. and O'Hara, M. (2012). Flow Toxicity and Liquidity in a High-Frequency World. Review of Financial Studies, 25(5), 1457–1493.