1) Bayesian deep learning combines deep learning and Bayesian modeling to address some limitations of each approach. It allows for principled uncertainty quantification in predictions and can model non-stationarity.
2) Deep learning performs well but only provides point estimates without uncertainty. Bayesian modeling provides uncertainty in predictions but has seen little application to machine learning.
3) Bayesian deep learning uses probabilistic programming to specify models with priors and perform inference to obtain posterior distributions over weights, enabling uncertainty estimates in deep learning.
Bayesian Deep Learning for Uncertainty and Non-Stationarity
1. Bayesian Deep Learning
Dealing with uncertainty and non-stationarity
Dr. Thomas Wiecki
@twiecki
Director of Data Science, Quantopian
2. Disclaimer
This presentation is for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation
for any security; nor does it constitute an offer to provide investment advisory or other services by Quantopian, Inc. ("Quantopian").
Nothing contained herein constitutes investment advice or offers any opinion with respect to the suitability of any security, and any
views expressed herein should not be taken as advice to buy, sell, or hold any security or as an endorsement of any security or
company. In preparing the information contained herein, Quantopian, Inc. has not taken into account the investment needs, objectives,
and financial circumstances of any particular investor. Any views expressed and data illustrated herein were prepared based upon
information, believed to be reliable, available to Quantopian, Inc. at the time of publication. Quantopian makes no guarantees as to their
accuracy or completeness. All information is subject to change and may quickly become unreliable for various reasons, including
changes in market conditions or economic circumstances.
3. Quantopian
>120.000 users
(as of April 1,
2017)
Community,
backtester + data,
real-money trading
competitions
Select best
trading strategies
and invest tens of
millions of dollars
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
5. Feature
Extraction
Hand-crafted alphas
Classifier
E.g. SVM, Random Forest
Linear risk models
E.g. PCA
Deep Learning
Alphas are learned directly,
instead of defined by hand.
Long-Short-Term-Memory
(LSTM), 1D convolutional nets
Non-linear, hierarchical
risk factors
Deep Auto-Encoder
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
6. However, certain problems in
algorithmic trading not well solved by
current deep learning research.
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
7. Non-Stationarity / Concept Drift
Markets change
Signals change / become obsolete
Usual solution:
Retrain model every t days, or,
when change is detected.
Unsatisfying:
Old data could still be useful.
Still assumes stationarity inside
window.
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
8. Uncertainty
⚫Models will always predict something, no
way of saying "I don't know".
⚫Unseen input can cause erratic behavior.
⚫Need uncertainty estimate of our
predictions.
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
9. Solution: Combine with Bayesian Modeling
Deep Learning
✓ Great performance
✓ Learn alphas directly from data
✓ Build better risk models
� Only point-estimates - No
uncertainty in predictions
� Can't deal with non-stationarity
Bayesian Modeling
✓ Principled uncertainty
quantification
✓ Very flexible (can model non-
stationarity)
Bayesian Deep LearningCONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
10. Bayesian Modeling: Coin flipping
Latent parameters
(Prior)
Likelihood of data,
given parameters.
Modelconstruction:
Howparameters
relatetodata
Inference:BayesFormula
mostlikelyparametersgiven
data
Data
(Heads / Tails)
Latent parameters
(Posterior)
p(heads)
Observe:
HTTHTTT
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
11. Probabilistic Programming
Latent causes
(Parameters)
Distribution
of Data
Modelconstruction:
Howwasdata
generated
Inference:BayesFormula
mostlikelyparametersgiven
data
Observed Data
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
12. ● Intuitive model specification syntax, for example, x ~ N(0,1) translates to x =
Normal('x', 0, 1)
● Sampling algorithms (MCMC): Accurate approximation of posterior, but slow.
● Variational inference (BBVI): Less accurate approximation, but much faster.
● Uses Theano as computational backend:
⚪ Computation optimization and dynamic C and GPU compilation
⚪ Linear algebra operators
⚪ Simple extensibility
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
14. Resources
⚫ Quantopian: https://www.quantopian.com
⚫ Quant equtiy workflow: https://blog.quantopian.com/a-professional-quant-equity-
workflow/
⚫ Quantopian implementation: https://www.quantopian.com/posts/machine-learning-on-
quantopian
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
15. Deep Learning: Pros and cons
Deep Learning
✓ Great performance
✓ Quite flexible
LSTMs, ConvNets, Neural Computers
✓ Scales well
� Only point-estimates - No uncertainty in predictions
� Overfits easily
� Can't deal with non-stationarity
Bayesian Modeling
✓ Unified framework for model building, inference,
prediction and decision making
✓ Bayesian: Principled uncertainty quantification of
parameters and predictions
✓ Extremely flexible (can model non-stationarity)
✓ Robust to overfitting
� Many conjugate / linear models
� Little application to ML
Natural to try and combine these two:
Bayesian Deep Learning
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
16. Random sample from input data
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
17. Random sample from output data
Looks like a vanilla classification problem. However...
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
18. Probabilistic Programming
1. Build model, specify prior belief.
2. Observe data, update belief to posterior.
3. Canonical example: Coin flipping
Model:
Random variable: p_heads = Beta(1, 1)
Likelihood: Bernoulli(data | p_heads)
Inference:
Infer posterior distribution P(p_heads | data)
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN
19. Disclaimer
This presentation is for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation
for any security; nor does it constitute an offer to provide investment advisory or other services by Quantopian, Inc. ("Quantopian").
Nothing contained herein constitutes investment advice or offers any opinion with respect to the suitability of any security, and any
views expressed herein should not be taken as advice to buy, sell, or hold any security or as an endorsement of any security or
company. In preparing the information contained herein, Quantopian, Inc. has not taken into account the investment needs, objectives,
and financial circumstances of any particular investor. Any views expressed and data illustrated herein were prepared based upon
information, believed to be reliable, available to Quantopian, Inc. at the time of publication. Quantopian makes no guarantees as to their
accuracy or completeness. All information is subject to change and may quickly become unreliable for various reasons, including
changes in market conditions or economic circumstances.
CONFIDENTIAL AND PROPRIETARY - NOT FOR DISTRIBUTION WITHOUT THE WRITTEN CONSENT OF QUANTOPIAN