How deep generative models can help quants reduce
the risk of overfitting? Applications of GANs for Quants.
Presentation at the "QuantUniversity Autumn School 2020".
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
How deep generative models can help quants reduce the risk of overfitting?
1. How deep generative models can help quants reduce
the risk of overfitting?
Talk at QuantUniversity Autumn School 2020
Gautier Marti
HKML Research
27 October 2020
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 1 / 59
2. Table of contents
1 Introduction
2 GANs explained
GANs Milestones & Major Achievements
How do GANs work?
3 Applications of GANs for Quants
Generating Synthetic Datasets to Avoid Strategy Overfitting
Generating Alternative Realistic Historical Paths
for Risk Estimation
4 Current State of the Art and Limitations
5 Conclusion and Questions?
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 2 / 59
4. Generative Adversarial Network’s Definition & Goal
(Deep) generative models are a broad class of models.
For the sake of clarity, we will only consider Generative Adversarial
Networks in this presentation.
Definition: Generative Adversarial Network (GAN)
A generative adversarial network (GAN) is a class of machine learning frame-
works where two neural networks (usually known as the generator and the
discriminator) contest with each other in a zero-sum game (i.e. one agent’s
gain is another agent’s loss).
Main purpose of a GAN: Generating realistic synthetic data
Given a training set, this technique learns to generate new data with the
same statistics as the training set.
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 4 / 59
5. Introduction (3 min. video)
https://www.youtube.com/watch?v=97B8tuHwLY0
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 5 / 59
6. Scope of the presentation
In this talk, we will focus on
doing a review of GANs success so far (mostly image generation),
explaining how Generative Adversarial Networks (GANs) work.
Then, we will present
applications of these models for quant researchers / traders use cases.
Finally, we shall briefly discuss
the current limitations and challenges to be overcome for a broader
adoption of these models in the industry.
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 6 / 59
8. Subsection 1
GANs Milestones & Major Achievements
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 8 / 59
9. GANs: A relatively new Deep Learning model (2014)
Goodfellow, Ian, et al. “Generative adversarial nets.”
Advances in neural information processing systems. 2014.
Cited by 22354 papers as of 18 September 2020.
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 9 / 59
10. Text to Photo-realistic Image Synthesis (2016)
https://arxiv.org/pdf/1612.03242.pdf
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 10 / 59
11. Deepfakes (2017)
Ctrl Shift Face (YouTube channel)
https://www.youtube.com/channel/UCKpH0CKltc73e4wh0_pgL3g
You Won’t Believe What Obama Says In This Video!
https://www.youtube.com/watch?v=cQ54GDm1eL0
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 11 / 59
12. Edmond de Belamy (2018)
Created by 3 students
First artwork created using
Artificial Intelligence to be
featured in a Christie’s auction
Sold for USD 432,500
Signed
minG maxD Ex [log(D(x))] +
Ez [log(1 − D(G(z)))]
In French, “bel ami” means
“good fellow”, a pun-tribute to
Ian Goodfellow, the creator of
GANs
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 12 / 59
13. StyleGAN (2019) & StyleGAN2 (2020)
GANs can generate realistic fake human faces:
Give it a try: https://thispersondoesnotexist.com/
NVIDIA StyleGAN paper: https://arxiv.org/pdf/1812.04948.pdf
NVIDIA StyleGAN2 paper: https://arxiv.org/pdf/1912.04958.pdf
Remark. In December 2019, Facebook took down a network of accounts
with false identities, and mentioned that some of them had used profile
pictures created with artificial intelligence.
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 13 / 59
14. Speech2Face & Wav2Pix (2019)
GANs conditioned on speech of a person can output a realistic face with
its correct gender, ethnicity, and approximate age:
Relevant papers:
Wav2Pix: https://arxiv.org/pdf/1903.10195.pdf
Speech2Face: https://arxiv.org/pdf/1905.09773.pdf
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 14 / 59
15. GameGAN (2020)
GameGAN is able to learn Pac-Man dynamics and produce a visually
consistent simulation of the game:
NVIDIA paper https://arxiv.org/pdf/2005.12126.pdf
https://www.youtube.com/watch?v=4OzJUNsPx60
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 15 / 59
16. Subsection 2
How do GANs work?
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 16 / 59
17. A GAN basic architecture
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 17 / 59
18. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 18 / 59
19. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 19 / 59
20. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 20 / 59
21. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 21 / 59
22. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 22 / 59
23. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 23 / 59
24. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 24 / 59
25. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 25 / 59
26. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 26 / 59
27. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 27 / 59
28. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 28 / 59
29. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 29 / 59
30. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 30 / 59
31. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 31 / 59
32. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 32 / 59
33. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 33 / 59
34. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 34 / 59
35. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 35 / 59
36. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 36 / 59
37. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 37 / 59
38. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 38 / 59
39. GAN training – step by step tutorial
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 39 / 59
40. Conditional Generative Adversarial Nets
Seminal paper: https://arxiv.org/pdf/1411.1784.pdf
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 40 / 59
42. Section 3
Applications of GANs for Quants
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 42 / 59
43. Subsection 1
Generating Synthetic Datasets to Avoid Strategy Overfitting
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 43 / 59
44. Strategy Overfitting
Scenario
In September 2020, a naive or unscrupulous strat presents to his
manager a new strategy: The strategy would have initiated a massive
short in February 2020, and would have bet big on a rally starting late
March 2020.
The strat sells the strategy to his manager as able to pick-up early
signals of market sell-offs and bounce-backs thanks to advanced
machine learning and alternative data (obviously, what else?).
The manager, excited, cannot wait but to deploy capital to it.
How to fight against this industry-wide fallacy?
Well-thought and carefully designed incentives schemes
(e.g. reward a sound research framework rather than impressive in-sample backtests)
Counterfactual thinking, realistic simulations of alternative paths
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 44 / 59
45. Strategy Overfitting – Simulations of Alternative Paths (1)
Some alternative data: Second-hand car market in Hong Kong
A tabular dataset X
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 45 / 59
46. Strategy Overfitting – Simulations of Alternative Paths (2)
econ quant idea: When inventory builds up (more people are selling their
cars than buying), then the HSI plummets over the next quarter.
math quant idea: My black-box ML algorithm predicts that HSI decreases
whenever two Ferraris are sold right after a Bugatti Veyron comes to
market, based on the given dataset.
Using GANs, we can sample new datasets ˆX ∼ X, or even ( ˆX, ˆy) ∼ (X, y),
where y can be the HSI performance or any variable we aim at predicting
(e.g. market+industry residualized returns of the respective carmakers).
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 46 / 59
47. Strategy Overfitting – Simulations of Alternative Paths (3)
Method 1: Strategy stability
Use a GAN to learn the distribution (X, y) of the tabular data
(cf. https://arxiv.org/pdf/1907.00503.pdf)
From the calibrated GAN, generate ˆX(n)
, ˆy(n)
N
n=1
synthetic datasets
Backtest the strategy on the N datasets, and collect perf. metrics
Analyze the perf. metrics; Discard the strategy if not stable.
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 47 / 59
48. Strategy Overfitting – Simulations of Alternative Paths (4)
Method 1bis: Find whether a strategy is robust and obvious given data
As the strat-quant team manager, provide each one of the N quants
with a GAN-generated copy of the original data.
They have to work on it independently.
Will they find the same strategy? With roughly the same parameters?
If so, the strategy is robust, but also likely to be crowded given the data.
Test it, and run it in production, on the original data.
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 48 / 59
49. Strategy Overfitting – Simulations of Alternative Paths (5)
In Koshiyama et al. (https://arxiv.org/pdf/1901.01751.pdf):
Generate N synthetic datasets:
Method 2: Strategy fine-tuning
Find the parameters which maximize the average perf. over the N datasets
Method 2bis: Strategy combination (ensemble models)
Fit a model on each of the N datasets
Predict using an ensemble of the N trained models
GAN vs. Stationary Bootstrap (for generating the N synthetic datasets)
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 49 / 59
50. Subsection 2
Generating Alternative Realistic Historical Paths
for Risk Estimation
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 50 / 59
51. Risk-based Portfolio Allocation (1)
Scenario
You want to systematically allocate capital to your strategies.
Literature claims that such or such method works better than all
others by providing a dubious backtest.
When you horse race the various allocation methods, results are not
stable across periods and universes.
How can we conclude anything useful? Realistic simulations!
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 51 / 59
52. CorrGAN: Sampling Realistic Financial Correlation
Matrices Using Generative Adversarial Networks
6 stylized facts of empirical
financial correlation matrices
Marchenko-Pastur-like distribution, except for:
a very large first eigenvalue,
a couple of other large eigenvalues
Perron-Frobenius property
positive correlations
Hierarchical structure of clusters
Scale-free property of the degrees in MST
Original paper:
https://arxiv.org/pdf/
1910.09504.pdf
Implemented in the MlFinlab
python package:
https://hudsonthames.
org/mlfinlab/
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 52 / 59
53. Risk-based Portfolio Allocation (2)
Method 3: Testing Portfolio Allocation on Alternative Historical Paths
Use a GAN to generate realistic synthetic correlation matrices
(cf. https://arxiv.org/pdf/1910.09504.pdf)
Generate time series verifying the correlation structure
Estimate portfolio weights (in-sample), measure out-of-sample risk
Analyze performance of the portfolio allocation methods
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 53 / 59
54. Risk-based Portfolio Allocation (3)
Question: Can we predict when a method (say the Hierarchical Risk
Parity (HRP)) outperforms another one (say naive risk parity)? And why?
Method 4: Understanding the outperformance of a method over another
Extract features from the underlying correlation matrix
Fit a ML model features → outperformance
(using train, validation, test datasets)
Verify if there is any good predictability
Explain the predictions as a function of features
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 54 / 59
55. Risk-based Portfolio Allocation (4)
Concrete example: HRP vs. naive risk parity
High values for the cophenetic correlation coefficient are characteristic of a strong
hierarchical structure. Thus, HRP outperforms naive risk parity when the
underlying DGP has a strong hierarchical structure (nested clusters).
cf. Jochen Papenbrock recent work for similar applications of Explainable AI (XAI) in finance (https://firamis.de/)
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 55 / 59
56. Section 4
Current State of the Art and Limitations
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 56 / 59
57. Current State of the Art and Limitations
This discussion is by nature technical, but we can highlight the following
limitations which are relevant for quants:
GANs can generate realistic tabular datasets (2019), but models
trained on synthetic data only were shown inferior to the ones trained
on the original data
We know how to GAN-generate realistic synthetic financial time series
(e.g. S&P 500 returns);
We know how to GAN-generate realistic synthetic financial correlation
matrices (of the S&P 500 constituents, for example);
However, we do not know yet how to GAN-generate realistic
multivariate financial time series, i.e. verifying both the time series
and the cross-sectional stylized facts
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 57 / 59
58. Section 5
Conclusion and Questions?
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 58 / 59
59. Conclusion and Questions?
Deep generative models and GANs in particular are an exciting new
technology.
In finance, they are actively researched in a few places but results are
not widely advertised.
We have to rely on top tech companies and academic labs to drive
the fundamental understanding and improvements of these models.
contact@hkml-research.com
Gautier Marti (HKML Research) Applications of GANs for Quants 27 October 2020 59 / 59