Muutke küpsiste eelistusi

Machine Learning for Factor Investing: R Version: R Version [Pehme köide]

Machine learning (ML) is progressively reshaping the fields of quantitative finance and algorithmic trading. ML tools are increasingly adopted by hedge funds and asset managers, notably for alpha signal generation and stocks selection. The technicality of the subject can make it hard for non-specialists to join the bandwagon, as the jargon and coding requirements may seem out of reach. Machine Learning for Factor Investing: R Version bridges this gap. It provides a comprehensive tour of modern ML-based investment strategies that rely on firm characteristics.

The book covers a wide array of subjects which range from economic rationales to rigorous portfolio back-testing and encompass both data processing and model interpretability. Common supervised learning algorithms such as tree models and neural networks are explained in the context of style investing and the reader can also dig into more complex techniques like autoencoder asset returns, Bayesian additive trees, and causal models.

All topics are illustrated with self-contained R code samples and snippets that are applied to a large public dataset that contains over 90 predictors. The material, along with the content of the book, is available online so that readers can reproduce and enhance the examples at their convenience. If you have even a basic knowledge of quantitative finance, this combination of theoretical concepts and practical illustrations will help you learn quickly and deepen your financial and technical expertise.

Arvustused

"This book is the perfect one for any data scientist on financial markets. It is well written, with lots of illustrations, examples, pieces of code, tips on the different statistical package available to perform the various algos. This book requires for sure a strong knowledge in quantitative finance and Machine Learning, so it cannot be put in any hands. But for those who are familiar with quantitative finance, this book can be a reference, as Hull's book is as regards to derivatives products. I liked the good and detailed analysis of the different Machine Learning algos, and the different examples used throughout the book. This book is perfect for assets managers having to run backtests and searching for innovative ways to enhance the return of their portfolios. I spent quite a good time reading this manuscript, and I would recommend it." (Frédéric Girod, Union of European Football Associations) "This book is the perfect one for any data scientist on financial markets. It is well written, with lots of illustrations, examples, pieces of code, tips on the different statistical package available to perform the various algos. This book requires for sure a strong knowledge in quantitative finance and Machine Learning, so it cannot be put in any hands. But for those who are familiar with quantitative finance, this book can be a reference, as Hull's book is as regards to derivatives products. I liked the good and detailed analysis of the different Machine Learning algos, and the different examples used throughout the book. This book is perfect for assets managers having to run backtests and searching for innovative ways to enhance the return of their portfolios. I spent quite a good time reading this manuscript, and I would recommend it." -Frédéric Girod, Union of European Football Associations

Preface xiii
I Introduction
1(54)
1 Notations and data
3(6)
1.1 Notations
3(1)
1.2 Dataset
4(5)
2 Introduction
9(4)
2.1 Context
9(1)
2.2 Portfolio construction: the workflow
10(1)
2.3 Machine learning is no magic wand
11(2)
3 Factor investing and asset pricing anomalies
13(22)
3.1 Introduction
14(1)
3.2 Detecting anomalies
15(12)
3.2.1 Challenges
15(1)
3.2.2 Simple portfolio sorts
15(2)
3.2.3 Factors
17(5)
3.2.4 Fama-Macbeth regressions
22(3)
3.2.5 Factor competition
25(1)
3.2.6 Advanced techniques
26(1)
3.3 Factors or characteristics?
27(1)
3.4 Hot topics: momentum, timing and ESG
28(2)
3.4.1 Factor momentum
28(1)
3.4.2 Factor timing
29(1)
3.4.3 The green factors
30(1)
3.5 The links with machine learning
30(4)
3.5.1 A short list of recent references
31(1)
3.5.2 Explicit connections with asset pricing models
31(3)
3.6 Coding exercises
34(1)
4 Data preprocessing
35(20)
4.1 Know your data
35(3)
4.2 Missing data
38(2)
4.3 Outlier detection
40(1)
4.4 Feature engineering
41(1)
4.4.1 Feature selection
41(1)
4.4.2 Scaling the predictors
41(1)
4.5 Labelling
42(5)
4.5.1 Simple labels
42(1)
4.5.2 Categorical labels
43(1)
4.5.3 The triple barrier method
44(1)
4.5.4 Filtering the sample
45(1)
4.5.5 Return horizons
46(1)
4.6 Handling persistence
47(1)
4.7 Extensions
47(3)
4.7.1 Transforming features
47(1)
4.7.2 Macro-economic variables
48(1)
4.7.3 Active learning
48(2)
4.8 Additional code and results
50(3)
4.8.1 Impact of rescaling: graphical representation
50(2)
4.8.2 Impact of rescaling: toy example
52(1)
4.9 Coding exercises
53(2)
II Common supervised algorithms
55(88)
5 Penalized regressions and sparse hedging for minimum variance portfolios
57(12)
5.1 Penalized regressions
57(5)
5.1.1 Simple regressions
57(1)
5.1.2 Forms of penalizations
58(2)
5.1.3 Illustrations
60(2)
5.2 Sparse hedging for minimum variance portfolios
62(5)
5.2.1 Presentation and derivations
62(3)
5.2.2 Example
65(2)
5.3 Predictive regressions
67(1)
5.3.1 Literature review and principle
67(1)
5.3.2 Code and results
68(1)
5.4 Coding exercise
68(1)
6 Tree-based methods
69(22)
6.1 Simple trees
69(7)
6.1.1 Principle
69(2)
6.1.2 Further details on classification
71(1)
6.1.3 Pruning criteria
72(1)
6.1.4 Code and interpretation
73(3)
6.2 Random forests
76(3)
6.2.1 Principle
76(2)
6.2.2 Code and results
78(1)
6.3 Boosted trees: Adaboost
79(3)
6.3.1 Methodology
79(3)
6.3.2 Illustration
82(1)
6.4 Boosted trees: extreme gradient boosting
82(7)
6.4.1 Managing loss
83(1)
6.4.2 Penalization
83(1)
6.4.3 Aggregation
84(1)
6.4.4 Tree structure
85(1)
6.4.5 Extensions
86(1)
6.4.6 Code and results
86(2)
6.4.7 Instance weighting
88(1)
6.5 Discussion
89(1)
6.6 Coding exercises
90(1)
7 Neural networks
91(32)
7.1 The original perceptron
92(1)
7.2 Multilayer perceptron
93(8)
7.2.1 Introduction and notations
93(3)
7.2.2 Universal approximation
96(1)
7.2.3 Learning via back-propagation
97(3)
7.2.4 Further details on classification
100(1)
7.3 How deep we should go and other practical issues
101(3)
7.3.1 Architectural choices
101(1)
7.3.2 Frequency of weight updates and learning duration
102(1)
7.3.3 Penalizations and dropout
103(1)
7.4 Code samples and comments for vanilla MLP
104(8)
7.4.1 Regression example
104(3)
7.4.2 Classification example
107(4)
7.4.3 Custom losses
111(1)
7.5 Recurrent networks
112(5)
7.5.1 Presentation
112(2)
7.5.2 Code and results
114(3)
7.6 Other common architectures
117(4)
7.6.1 Generative adversarial networks
117(1)
7.6.2 Autoencoders
118(1)
7.6.3 A word on convolutional networks
119(2)
7.6.4 Advanced architectures
121(1)
7.7 Coding exercise
121(2)
8 Support vector machines
123(6)
8.1 SVM for classification
123(3)
8.2 SVM for regression
126(1)
8.3 Practice
127(1)
8.4 Coding exercises
128(1)
9 Bayesian methods
129(14)
9.1 The Bayesian framework
129(2)
9.2 Bayesian sampling
131(1)
9.2.1 Gibbs sampling
131(1)
9.2.2 Metropolis-Hastings sampling
131(1)
9.3 Bayesian linear regression
132(3)
9.4 Naive Bayes classifier
135(3)
9.5 Bayesian additive trees
138(5)
9.5.1 General formulation
138(1)
9.5.2 Priors
138(1)
9.5.3 Sampling and predictions
139(2)
9.5.4 Code
141(2)
III From predictions to portfolios
143(54)
10 Validating and tuning
145(20)
10.1 Learning metrics
145(6)
10.1.1 Regression analysis
145(2)
10.1.2 Classification analysis
147(4)
10.2 Validation
151(7)
10.2.1 The variance-bias tradeoff: theory
151(3)
10.2.2 The variance-bias tradeoff: illustration
154(2)
10.2.3 The risk of overfitting: principle
156(1)
10.2.4 The risk of overfitting: some solutions
157(1)
10.3 The search for good hyperparameters
158(5)
10.3.1 Methods
158(2)
10.3.2 Example: grid search
160(2)
10.3.3 Example: Bayesian optimization
162(1)
10.4 Short discussion on validation in backtests
163(2)
11 Ensemble models
165(12)
11.1 Linear ensembles
166(4)
11.1.1 Principles
166(1)
11.1.2 Example
167(3)
11.2 Stacked ensembles
170(2)
11.2.1 Two-stage training
170(1)
11.2.2 Code and results
170(2)
11.3 Extensions
172(4)
11.3.1 Exogenous variables
172(1)
11.3.2 Shrinking inter-model correlations
173(3)
11.4 Exercise
176(1)
12 Portfolio backtesting
177(20)
12.1 Setting the protocol
177(2)
12.2 Turning signals into portfolio weights
179(2)
12.3 Performance metrics
181(4)
12.3.1 Discussion
181(1)
12.3.2 Pure performance and risk indicators
182(1)
12.3.3 Factor-based evaluation
183(1)
12.3.4 Risk-adjusted measures
184(1)
12.3.5 Transaction costs and turnover
184(1)
12.4 Common errors and issues
185(2)
12.4.1 Forward looking data
185(1)
12.4.2 Backtest overfitting
185(2)
12.4.3 Simple safeguards
187(1)
12.5 Implication of non-stationarity: forecasting is hard
187(2)
12.5.1 General comments
187(1)
12.5.2 The no free lunch theorem
188(1)
12.6 First example: a complete backtest
189(4)
12.7 Second example: backtest overfitting
193(3)
12.8 Coding exercises
196(1)
IV Further important topics
197(64)
13 Interpretability
199(16)
13.1 Global interpretations
200(6)
13.1.1 Simple models as surrogates
200(1)
13.1.2 Variable importance (tree-based)
201(2)
13.1.3 Variable importance (agnostic)
203(2)
13.1.4 Partial dependence plot
205(1)
13.2 Local interpretations
206(9)
13.2.1 LIME
207(3)
13.2.2 Shapley values
210(2)
13.2.3 Breakdown
212(3)
14 Two key concepts: causality and non-stationarity
215(18)
14.1 Causality
216(7)
14.1.1 Granger causality
216(1)
14.1.2 Causal additive models
217(3)
14.1.3 Structural time series models
220(3)
14.2 Dealing with changing environments
223(10)
14.2.1 Non-stationarity: yet another illustration
225(2)
14.2.2 Online learning
227(2)
14.2.3 Homogeneous transfer learning
229(4)
15 Unsupervised learning
233(14)
15.1 The problem with correlated predictors
233(2)
15.2 Principal component analysis and autoencoders
235(6)
15.2.1 A bit of algebra
236(1)
15.2.2 PCA
236(3)
15.2.3 Autoencoders
239(1)
15.2.4 Application
240(1)
15.3 Clustering via k-means
241(2)
15.4 Nearest neighbors
243(2)
15.5 Coding exercise
245(2)
16 Reinforcement learning
247(14)
16.1 Theoretical layout
247(5)
16.1.1 General framework
247(2)
16.1.2 Q-learning
249(2)
16.1.3 SARSA
251(1)
16.2 The curse of dimensionality
252(1)
16.3 Policy gradient
253(3)
16.3.1 Principle
253(1)
16.3.2 Extensions
254(2)
16.4 Simple examples
256(3)
16.4.1 Q-learning with simulations
256(1)
16.4.2 Q-learning with market data
257(2)
16.5 Concluding remarks
259(1)
16.6 Exercises
260(1)
V Appendix
261(28)
17 Data description
263(4)
18 Solutions to exercises
267(22)
18.1
Chapter 4
267(2)
18.2
Chapter 5
269(4)
18.3
Chapter 6
273(1)
18.4
Chapter 7
273(3)
18.5
Chapter 8: the autoencoder model
276(2)
18.6
Chapter 9
278(1)
18.7
Chapter 12: ensemble neural network
279(2)
18.8
Chapter 13
281(4)
18.8.1 EW portfolios with the tidyverse
281(1)
18.8.2 Advanced weighting function
282(1)
18.8.3 Functional programming in the backtest
283(2)
18.9
Chapter 16
285(1)
18.10
Chapter 17
285(4)
Bibliography 289(30)
Index 319
Guillaume Coqueret is associate professor of finance and data science at EMLYON Business School. His recent research revolves around applications of machine learning tools in financial economics.

Tony Guida is executive director at RAM Active Investments. He serves as chair of the machineByte think tank and is the author of Big Data and Machine Learning in Quantitative Investment.