SlideShare a Scribd company logo
1 of 36
Download to read offline
Bayesian Portfolio Allocation
Thomas Wiecki,PhD
PyMC Labs
QWAFAFEW
Boston, MA
ANNOUNCEMENTS
Hugh Crowther
QU Winter school 2021
● Theme: AI and ML Enablement
○ Data Science with Python
○ AI & Machine Learning for Financial Professionals
○ Model Risk & Governance
● https://quwinterschool.splashthat.com/
Slides and Code
● QuAcademy: www.qu.academy
Thomas Wiecki is the Chief Executive Officer at PyMC Labs, a
Bayesian consultancy (www.pymc-labs.io). Prior to that Thomas
was the VP of Data Science at Quantopian, where he used
probabilistic programming and machine learning to help build
the world’s first crowdsourced hedge fund. Among other open
source projects, he is involved in the development of PyMC3—a
probabilistic programming framework for Python. He holds a
PhD from Brown University.
Bayesian Portfolio Allocation
Thomas Wiecki, PhD
@twiecki
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.
● Bayesian consultancy by the inventors of PyMC3
● Solving advanced analytical problems
● Team consists of PhDs, mathematicians, neuroscientists, and a former SpaceX rocket scientist
● Clients in pharma (Roche), fintech, mortgage, agriculture, adtech, biotech...
● www.pymc-labs.io
8
Markowitz mean-variance optimization
● Optimal portfolio - in theory - taking mean return, volatility and correlations into account
● Highly sub-optimal in practice, why?
○ Estimates are very noisy, but we do not quantify that noise
○ Leads to lack of diversification
● Many hacks… err solutions, exist:
○ Equal-weight (MVO but assuming means and vol are equal and no correlations exist)
○ Inverse-variance weighting (MVO but assuming means are equal and no correlations exist)
○ Hierarchical Risk Parity
○ ...
Bayesian statistics allows to build models flexibly
vs
Bayesian statistics allows specification of prior information
+
Not single most likely solution, but all probable solutions
Instead of point-estimates (scalar values) of e.g. the mean or variance, we use probability distributions that quantify
uncertainty.
Point estimates
Probability distributions
Given 16 strategies, how to weight them?
Where we are
Data
Bayesian Modeling: Coin flipping
Parameters
Prior p(θ)
Likelihood p(x | θ)
Model
construction:
How
parameters
relate
to
data
Inference:
Bayes
Formula
most
likely
parameters
given
data
Data x
(Heads / Tails)
Parameters
Posterior p(θ | x)
p(heads)
Observe:
HTTHTTT
belief
Probabilistic Programming
Parameters
Prior p(θ)
Likelihood p(x | θ)
Model
construction:
How
parameters
relate
to
data
Inference:
Bayes
Formula
most
likely
parameters
given
data
Data x
(Heads / Tails)
Parameters
Posterior p(θ | x)
p(heads)
Observe:
HTTHTTT
belief
code
a
u
t
o
m
a
t
i
c
(
M
C
M
C
)
T-Distribution
Modeling financial returns
Inference:
Bayes
Formula
probability
of
parameters
given
data
Latent causes
(Parameters)
Distribution
of Data
Observed Data
● mean returns
● volatility
● tails
Where we are
Data
Model
● Probabilistic Programming framework for Python, FOSS
● Specify arbitrary models in code by plugging probability distributions into each other
● Intuitive model specification syntax
○ For example: x ~ N(0,1) translates to x = Normal('x', 0, 1)
● Inference Button: Automatic and powerful inference for any model
The model in
Parameters /
Priors
Inference
Model specification
Where we are
Data
Model
Posterior
Posterior probability that strategy is profitable (SR > 0)
Where we are
Data
Model
Posterior
Predictions
Bayesian Decision Making
● So far we only have probability distributions for our strategies.
● How to construct a portfolio from them?
● Use model to generate all kinds of possible future scenarios (prediction)
● Define loss function that rates how good a solution is given a scenario
● Use optimizer to find best solution across all possible future scenarios
Bayesian Decision Making
Data
Model
Posterior
Predictions
Optimizer
Loss
function
Decision
Predictions
● Generate possible future scenarios by
drawing parameter set from posterior &
sampling from likelihood
● Two sources of variability: Likelihood &
uncertainty
Bayesian Decision Making
Data
Model
Posterior
Predictions
Optimizer
Loss
function
Decision
Loss function for Mean-Variance
● Utility theory tells us to minimize our
expected losses (maximizing wins leads to
overly risky behavior)
● Black-Littermann: −exp(−λr(ω)), where r(ω)
are the expected returns if we used portfolio
weights ω, λ is how averse to losses we are
Example
def loss_function(ω): # weight vector, e.g.
[1/16, 1/16, …]
loss = 0
for r in sampled_returns:
# compute portfolio returns
port_rets = sum(r * ω)
loss += -exp(-port_rets)
return loss
Bayesian Decision Making
Data
Model
Posterior
Predictions
Optimizer
Loss
function
Decision
Optimization → Output
● Finds optimal portfolio weights ω which minimize expected loss
● In our case: loss function is convex so we can use convex solvers (cvxpy) which are much faster, otherwise, use
scipy.optimizer.fmin().
The full model
● Changes in volatility and mean over time using GPs
● Hierarchical estimation to pool information from batch of algorithms
● Correlations
Benefits
● Robust due to using posterior distributions rather than point-estimates
● Different length track-records are automatically handled
○ Short but great track-record: high uncertainty -> many potentially bad outcomes -> low weight
● Model can be improved to include all kinds of structure, like risk-factors, prior information we might have (e.g.
knowing a certain manager well).
Further reading
www.pymc-labs.io
@twiecki
https://docs.pymc.io
Bayesian Decision Making blog post: https://twiecki.io/blog/2019/01/14/supply_chain/
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.
Thanks for joining!
Questions

More Related Content

What's hot

Introduction to Generalized Linear Models
Introduction to Generalized Linear ModelsIntroduction to Generalized Linear Models
Introduction to Generalized Linear Modelsrichardchandler
 
Feature Engineering - Getting most out of data for predictive models - TDC 2017
Feature Engineering - Getting most out of data for predictive models - TDC 2017Feature Engineering - Getting most out of data for predictive models - TDC 2017
Feature Engineering - Getting most out of data for predictive models - TDC 2017Gabriel Moreira
 
Logistic Regression.pptx
Logistic Regression.pptxLogistic Regression.pptx
Logistic Regression.pptxMuskaan194530
 
Bayesian Deep Learning
Bayesian Deep LearningBayesian Deep Learning
Bayesian Deep LearningRayKim51
 
The linear regression model: Theory and Application
The linear regression model: Theory and ApplicationThe linear regression model: Theory and Application
The linear regression model: Theory and ApplicationUniversity of Salerno
 
Logistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | DisadvantagesLogistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | DisadvantagesRajat Sharma
 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionMartinHogg9
 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionDrZahid Khan
 
glmmstanパッケージを作ってみた
glmmstanパッケージを作ってみたglmmstanパッケージを作ってみた
glmmstanパッケージを作ってみたHiroshi Shimizu
 
相関係数は傾きに影響される
相関係数は傾きに影響される相関係数は傾きに影響される
相関係数は傾きに影響されるMitsuo Shimohata
 
Key performance indicators
Key performance indicatorsKey performance indicators
Key performance indicatorsNagarjuna Adiga
 
Mplusの使い方 中級編
Mplusの使い方 中級編Mplusの使い方 中級編
Mplusの使い方 中級編Hiroshi Shimizu
 
MCMCでマルチレベルモデル
MCMCでマルチレベルモデルMCMCでマルチレベルモデル
MCMCでマルチレベルモデルHiroshi Shimizu
 
diffusion 모델부터 DALLE2까지.pdf
diffusion 모델부터 DALLE2까지.pdfdiffusion 모델부터 DALLE2까지.pdf
diffusion 모델부터 DALLE2까지.pdf수철 박
 
Machine Learning Unit 4 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 4 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 4 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 4 Semester 3 MSc IT Part 2 Mumbai UniversityMadhav Mishra
 

What's hot (20)

Introduction to Generalized Linear Models
Introduction to Generalized Linear ModelsIntroduction to Generalized Linear Models
Introduction to Generalized Linear Models
 
Feature Engineering - Getting most out of data for predictive models - TDC 2017
Feature Engineering - Getting most out of data for predictive models - TDC 2017Feature Engineering - Getting most out of data for predictive models - TDC 2017
Feature Engineering - Getting most out of data for predictive models - TDC 2017
 
Logistic Regression.pptx
Logistic Regression.pptxLogistic Regression.pptx
Logistic Regression.pptx
 
Simple linear regression
Simple linear regressionSimple linear regression
Simple linear regression
 
Bayesian Deep Learning
Bayesian Deep LearningBayesian Deep Learning
Bayesian Deep Learning
 
The linear regression model: Theory and Application
The linear regression model: Theory and ApplicationThe linear regression model: Theory and Application
The linear regression model: Theory and Application
 
Poisson regression models for count data
Poisson regression models for count dataPoisson regression models for count data
Poisson regression models for count data
 
Regression analysis on SPSS
Regression analysis on SPSSRegression analysis on SPSS
Regression analysis on SPSS
 
Linear Regression
Linear RegressionLinear Regression
Linear Regression
 
Logistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | DisadvantagesLogistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | Disadvantages
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
 
glmmstanパッケージを作ってみた
glmmstanパッケージを作ってみたglmmstanパッケージを作ってみた
glmmstanパッケージを作ってみた
 
相関係数は傾きに影響される
相関係数は傾きに影響される相関係数は傾きに影響される
相関係数は傾きに影響される
 
Key performance indicators
Key performance indicatorsKey performance indicators
Key performance indicators
 
Mplusの使い方 中級編
Mplusの使い方 中級編Mplusの使い方 中級編
Mplusの使い方 中級編
 
MCMCでマルチレベルモデル
MCMCでマルチレベルモデルMCMCでマルチレベルモデル
MCMCでマルチレベルモデル
 
diffusion 모델부터 DALLE2까지.pdf
diffusion 모델부터 DALLE2까지.pdfdiffusion 모델부터 DALLE2까지.pdf
diffusion 모델부터 DALLE2까지.pdf
 
Machine Learning Unit 4 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 4 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 4 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 4 Semester 3 MSc IT Part 2 Mumbai University
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
 

Similar to Bayesian Portfolio Allocation

"Bayesian Deep Learning: Dealing with Uncertainty and Non-Stationarity" by Dr...
"Bayesian Deep Learning: Dealing with Uncertainty and Non-Stationarity" by Dr..."Bayesian Deep Learning: Dealing with Uncertainty and Non-Stationarity" by Dr...
"Bayesian Deep Learning: Dealing with Uncertainty and Non-Stationarity" by Dr...Quantopian
 
Applying Monte Carlo Simulation to Microsoft Project Schedules
Applying Monte Carlo Simulation to Microsoft Project SchedulesApplying Monte Carlo Simulation to Microsoft Project Schedules
Applying Monte Carlo Simulation to Microsoft Project Schedulesjimparkpmp
 
Machine learning for factor investing
Machine learning for factor investingMachine learning for factor investing
Machine learning for factor investingQuantUniversity
 
Jacobs Kiefer Bayes Guide 3 10 V1
Jacobs Kiefer Bayes Guide 3 10 V1Jacobs Kiefer Bayes Guide 3 10 V1
Jacobs Kiefer Bayes Guide 3 10 V1Michael Jacobs, Jr.
 
Probabilistic programming products by Michael Lee Williams
Probabilistic programming products by Michael Lee WilliamsProbabilistic programming products by Michael Lee Williams
Probabilistic programming products by Michael Lee WilliamsData Con LA
 
Synthetic VIX Data Generation Using ML Techniques
Synthetic VIX Data Generation Using ML TechniquesSynthetic VIX Data Generation Using ML Techniques
Synthetic VIX Data Generation Using ML TechniquesQuantUniversity
 
How Traditional Risk Reporting Has Let Us Down
How Traditional Risk Reporting Has Let Us DownHow Traditional Risk Reporting Has Let Us Down
How Traditional Risk Reporting Has Let Us DownAcumen
 
Making better use of Data and AI in Industry 4.0
Making better use of Data and AI in Industry 4.0Making better use of Data and AI in Industry 4.0
Making better use of Data and AI in Industry 4.0Albert Y. C. Chen
 
loanpredictionsystem-210808032534.pptx
loanpredictionsystem-210808032534.pptxloanpredictionsystem-210808032534.pptx
loanpredictionsystem-210808032534.pptx081JeetPatel
 
Human in the loop: Bayesian Rules Enabling Explainable AI
Human in the loop: Bayesian Rules Enabling Explainable AIHuman in the loop: Bayesian Rules Enabling Explainable AI
Human in the loop: Bayesian Rules Enabling Explainable AIPramit Choudhary
 
Constructing Private Asset Benchmarks
Constructing Private Asset BenchmarksConstructing Private Asset Benchmarks
Constructing Private Asset BenchmarksQuantUniversity
 
Disrupting Risk Management through Emerging Technologies
Disrupting Risk Management through Emerging TechnologiesDisrupting Risk Management through Emerging Technologies
Disrupting Risk Management through Emerging TechnologiesDatabricks
 
PythonQuants conference - QuantUniversity presentation - Stress Testing in th...
PythonQuants conference - QuantUniversity presentation - Stress Testing in th...PythonQuants conference - QuantUniversity presentation - Stress Testing in th...
PythonQuants conference - QuantUniversity presentation - Stress Testing in th...QuantUniversity
 
Qu speaker series 14: Synthetic Data Generation in Finance
Qu speaker series 14: Synthetic Data Generation in FinanceQu speaker series 14: Synthetic Data Generation in Finance
Qu speaker series 14: Synthetic Data Generation in FinanceQuantUniversity
 
Splunk for Security - Hands-On
Splunk for Security - Hands-OnSplunk for Security - Hands-On
Splunk for Security - Hands-OnSplunk
 
Classification of quantitative trading strategies webinar ppt
Classification of quantitative trading strategies webinar pptClassification of quantitative trading strategies webinar ppt
Classification of quantitative trading strategies webinar pptQuantInsti
 
Uncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial IntelligenceUncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial IntelligenceExperfy
 
AI model security.pdf
AI model security.pdfAI model security.pdf
AI model security.pdfStephenAmell4
 
Deep learning fast and slow, a responsible and explainable AI framework - Ahm...
Deep learning fast and slow, a responsible and explainable AI framework - Ahm...Deep learning fast and slow, a responsible and explainable AI framework - Ahm...
Deep learning fast and slow, a responsible and explainable AI framework - Ahm...Institute of Contemporary Sciences
 

Similar to Bayesian Portfolio Allocation (20)

"Bayesian Deep Learning: Dealing with Uncertainty and Non-Stationarity" by Dr...
"Bayesian Deep Learning: Dealing with Uncertainty and Non-Stationarity" by Dr..."Bayesian Deep Learning: Dealing with Uncertainty and Non-Stationarity" by Dr...
"Bayesian Deep Learning: Dealing with Uncertainty and Non-Stationarity" by Dr...
 
Applying Monte Carlo Simulation to Microsoft Project Schedules
Applying Monte Carlo Simulation to Microsoft Project SchedulesApplying Monte Carlo Simulation to Microsoft Project Schedules
Applying Monte Carlo Simulation to Microsoft Project Schedules
 
Machine learning for factor investing
Machine learning for factor investingMachine learning for factor investing
Machine learning for factor investing
 
Jacobs Kiefer Bayes Guide 3 10 V1
Jacobs Kiefer Bayes Guide 3 10 V1Jacobs Kiefer Bayes Guide 3 10 V1
Jacobs Kiefer Bayes Guide 3 10 V1
 
Probabilistic programming products by Michael Lee Williams
Probabilistic programming products by Michael Lee WilliamsProbabilistic programming products by Michael Lee Williams
Probabilistic programming products by Michael Lee Williams
 
Synthetic VIX Data Generation Using ML Techniques
Synthetic VIX Data Generation Using ML TechniquesSynthetic VIX Data Generation Using ML Techniques
Synthetic VIX Data Generation Using ML Techniques
 
How Traditional Risk Reporting Has Let Us Down
How Traditional Risk Reporting Has Let Us DownHow Traditional Risk Reporting Has Let Us Down
How Traditional Risk Reporting Has Let Us Down
 
Making better use of Data and AI in Industry 4.0
Making better use of Data and AI in Industry 4.0Making better use of Data and AI in Industry 4.0
Making better use of Data and AI in Industry 4.0
 
loanpredictionsystem-210808032534.pptx
loanpredictionsystem-210808032534.pptxloanpredictionsystem-210808032534.pptx
loanpredictionsystem-210808032534.pptx
 
Human in the loop: Bayesian Rules Enabling Explainable AI
Human in the loop: Bayesian Rules Enabling Explainable AIHuman in the loop: Bayesian Rules Enabling Explainable AI
Human in the loop: Bayesian Rules Enabling Explainable AI
 
Constructing Private Asset Benchmarks
Constructing Private Asset BenchmarksConstructing Private Asset Benchmarks
Constructing Private Asset Benchmarks
 
Disrupting Risk Management through Emerging Technologies
Disrupting Risk Management through Emerging TechnologiesDisrupting Risk Management through Emerging Technologies
Disrupting Risk Management through Emerging Technologies
 
PythonQuants conference - QuantUniversity presentation - Stress Testing in th...
PythonQuants conference - QuantUniversity presentation - Stress Testing in th...PythonQuants conference - QuantUniversity presentation - Stress Testing in th...
PythonQuants conference - QuantUniversity presentation - Stress Testing in th...
 
Qu speaker series 14: Synthetic Data Generation in Finance
Qu speaker series 14: Synthetic Data Generation in FinanceQu speaker series 14: Synthetic Data Generation in Finance
Qu speaker series 14: Synthetic Data Generation in Finance
 
cas_washington_nov2010_web
cas_washington_nov2010_webcas_washington_nov2010_web
cas_washington_nov2010_web
 
Splunk for Security - Hands-On
Splunk for Security - Hands-OnSplunk for Security - Hands-On
Splunk for Security - Hands-On
 
Classification of quantitative trading strategies webinar ppt
Classification of quantitative trading strategies webinar pptClassification of quantitative trading strategies webinar ppt
Classification of quantitative trading strategies webinar ppt
 
Uncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial IntelligenceUncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial Intelligence
 
AI model security.pdf
AI model security.pdfAI model security.pdf
AI model security.pdf
 
Deep learning fast and slow, a responsible and explainable AI framework - Ahm...
Deep learning fast and slow, a responsible and explainable AI framework - Ahm...Deep learning fast and slow, a responsible and explainable AI framework - Ahm...
Deep learning fast and slow, a responsible and explainable AI framework - Ahm...
 

More from QuantUniversity

EU Artificial Intelligence Act 2024 passed !
EU Artificial Intelligence Act 2024 passed !EU Artificial Intelligence Act 2024 passed !
EU Artificial Intelligence Act 2024 passed !QuantUniversity
 
Managing-the-Risks-of-LLMs-in-FS-Industry-Roundtable-TruEra-QuantU.pdf
Managing-the-Risks-of-LLMs-in-FS-Industry-Roundtable-TruEra-QuantU.pdfManaging-the-Risks-of-LLMs-in-FS-Industry-Roundtable-TruEra-QuantU.pdf
Managing-the-Risks-of-LLMs-in-FS-Industry-Roundtable-TruEra-QuantU.pdfQuantUniversity
 
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALS
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALSPYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALS
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALSQuantUniversity
 
Qu for India - QuantUniversity FundRaiser
Qu for India  - QuantUniversity FundRaiserQu for India  - QuantUniversity FundRaiser
Qu for India - QuantUniversity FundRaiserQuantUniversity
 
Ml master class for CFA Dallas
Ml master class for CFA DallasMl master class for CFA Dallas
Ml master class for CFA DallasQuantUniversity
 
Algorithmic auditing 1.0
Algorithmic auditing 1.0Algorithmic auditing 1.0
Algorithmic auditing 1.0QuantUniversity
 
Towards Fairer Datasets: Filtering and Balancing the Distribution of the Peop...
Towards Fairer Datasets: Filtering and Balancing the Distribution of the Peop...Towards Fairer Datasets: Filtering and Balancing the Distribution of the Peop...
Towards Fairer Datasets: Filtering and Balancing the Distribution of the Peop...QuantUniversity
 
Machine Learning: Considerations for Fairly and Transparently Expanding Acces...
Machine Learning: Considerations for Fairly and Transparently Expanding Acces...Machine Learning: Considerations for Fairly and Transparently Expanding Acces...
Machine Learning: Considerations for Fairly and Transparently Expanding Acces...QuantUniversity
 
Seeing what a gan cannot generate: paper review
Seeing what a gan cannot generate: paper reviewSeeing what a gan cannot generate: paper review
Seeing what a gan cannot generate: paper reviewQuantUniversity
 
AI Explainability and Model Risk Management
AI Explainability and Model Risk ManagementAI Explainability and Model Risk Management
AI Explainability and Model Risk ManagementQuantUniversity
 
Algorithmic auditing 1.0
Algorithmic auditing 1.0Algorithmic auditing 1.0
Algorithmic auditing 1.0QuantUniversity
 
Machine Learning in Finance: 10 Things You Need to Know in 2021
Machine Learning in Finance: 10 Things You Need to Know in 2021Machine Learning in Finance: 10 Things You Need to Know in 2021
Machine Learning in Finance: 10 Things You Need to Know in 2021QuantUniversity
 
Machine Learning Interpretability
Machine Learning InterpretabilityMachine Learning Interpretability
Machine Learning InterpretabilityQuantUniversity
 
Responsible AI in Action
Responsible AI in ActionResponsible AI in Action
Responsible AI in ActionQuantUniversity
 
Qu speaker series:Ethical Use of AI in Financial Markets
Qu speaker series:Ethical Use of AI in Financial MarketsQu speaker series:Ethical Use of AI in Financial Markets
Qu speaker series:Ethical Use of AI in Financial MarketsQuantUniversity
 
Fintech in the Post-Covid Age
Fintech in the Post-Covid AgeFintech in the Post-Covid Age
Fintech in the Post-Covid AgeQuantUniversity
 
Ml master class northeastern university
Ml master class   northeastern universityMl master class   northeastern university
Ml master class northeastern universityQuantUniversity
 

More from QuantUniversity (20)

EU Artificial Intelligence Act 2024 passed !
EU Artificial Intelligence Act 2024 passed !EU Artificial Intelligence Act 2024 passed !
EU Artificial Intelligence Act 2024 passed !
 
Managing-the-Risks-of-LLMs-in-FS-Industry-Roundtable-TruEra-QuantU.pdf
Managing-the-Risks-of-LLMs-in-FS-Industry-Roundtable-TruEra-QuantU.pdfManaging-the-Risks-of-LLMs-in-FS-Industry-Roundtable-TruEra-QuantU.pdf
Managing-the-Risks-of-LLMs-in-FS-Industry-Roundtable-TruEra-QuantU.pdf
 
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALS
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALSPYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALS
PYTHON AND DATA SCIENCE FOR INVESTMENT PROFESSIONALS
 
Qu for India - QuantUniversity FundRaiser
Qu for India  - QuantUniversity FundRaiserQu for India  - QuantUniversity FundRaiser
Qu for India - QuantUniversity FundRaiser
 
Ml master class for CFA Dallas
Ml master class for CFA DallasMl master class for CFA Dallas
Ml master class for CFA Dallas
 
Algorithmic auditing 1.0
Algorithmic auditing 1.0Algorithmic auditing 1.0
Algorithmic auditing 1.0
 
Towards Fairer Datasets: Filtering and Balancing the Distribution of the Peop...
Towards Fairer Datasets: Filtering and Balancing the Distribution of the Peop...Towards Fairer Datasets: Filtering and Balancing the Distribution of the Peop...
Towards Fairer Datasets: Filtering and Balancing the Distribution of the Peop...
 
Machine Learning: Considerations for Fairly and Transparently Expanding Acces...
Machine Learning: Considerations for Fairly and Transparently Expanding Acces...Machine Learning: Considerations for Fairly and Transparently Expanding Acces...
Machine Learning: Considerations for Fairly and Transparently Expanding Acces...
 
Seeing what a gan cannot generate: paper review
Seeing what a gan cannot generate: paper reviewSeeing what a gan cannot generate: paper review
Seeing what a gan cannot generate: paper review
 
AI Explainability and Model Risk Management
AI Explainability and Model Risk ManagementAI Explainability and Model Risk Management
AI Explainability and Model Risk Management
 
Algorithmic auditing 1.0
Algorithmic auditing 1.0Algorithmic auditing 1.0
Algorithmic auditing 1.0
 
Machine Learning in Finance: 10 Things You Need to Know in 2021
Machine Learning in Finance: 10 Things You Need to Know in 2021Machine Learning in Finance: 10 Things You Need to Know in 2021
Machine Learning in Finance: 10 Things You Need to Know in 2021
 
The API Jungle
The API JungleThe API Jungle
The API Jungle
 
Explainable AI Workshop
Explainable AI WorkshopExplainable AI Workshop
Explainable AI Workshop
 
Machine Learning Interpretability
Machine Learning InterpretabilityMachine Learning Interpretability
Machine Learning Interpretability
 
Responsible AI in Action
Responsible AI in ActionResponsible AI in Action
Responsible AI in Action
 
Qwafafew meeting 5
Qwafafew meeting 5Qwafafew meeting 5
Qwafafew meeting 5
 
Qu speaker series:Ethical Use of AI in Financial Markets
Qu speaker series:Ethical Use of AI in Financial MarketsQu speaker series:Ethical Use of AI in Financial Markets
Qu speaker series:Ethical Use of AI in Financial Markets
 
Fintech in the Post-Covid Age
Fintech in the Post-Covid AgeFintech in the Post-Covid Age
Fintech in the Post-Covid Age
 
Ml master class northeastern university
Ml master class   northeastern universityMl master class   northeastern university
Ml master class northeastern university
 

Recently uploaded

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Recently uploaded (20)

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 

Bayesian Portfolio Allocation

  • 1. Bayesian Portfolio Allocation Thomas Wiecki,PhD PyMC Labs QWAFAFEW Boston, MA
  • 3. QU Winter school 2021 ● Theme: AI and ML Enablement ○ Data Science with Python ○ AI & Machine Learning for Financial Professionals ○ Model Risk & Governance ● https://quwinterschool.splashthat.com/
  • 4. Slides and Code ● QuAcademy: www.qu.academy
  • 5. Thomas Wiecki is the Chief Executive Officer at PyMC Labs, a Bayesian consultancy (www.pymc-labs.io). Prior to that Thomas was the VP of Data Science at Quantopian, where he used probabilistic programming and machine learning to help build the world’s first crowdsourced hedge fund. Among other open source projects, he is involved in the development of PyMC3—a probabilistic programming framework for Python. He holds a PhD from Brown University.
  • 7. 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.
  • 8. ● Bayesian consultancy by the inventors of PyMC3 ● Solving advanced analytical problems ● Team consists of PhDs, mathematicians, neuroscientists, and a former SpaceX rocket scientist ● Clients in pharma (Roche), fintech, mortgage, agriculture, adtech, biotech... ● www.pymc-labs.io 8
  • 9. Markowitz mean-variance optimization ● Optimal portfolio - in theory - taking mean return, volatility and correlations into account ● Highly sub-optimal in practice, why? ○ Estimates are very noisy, but we do not quantify that noise ○ Leads to lack of diversification ● Many hacks… err solutions, exist: ○ Equal-weight (MVO but assuming means and vol are equal and no correlations exist) ○ Inverse-variance weighting (MVO but assuming means are equal and no correlations exist) ○ Hierarchical Risk Parity ○ ...
  • 10. Bayesian statistics allows to build models flexibly vs
  • 11. Bayesian statistics allows specification of prior information +
  • 12. Not single most likely solution, but all probable solutions Instead of point-estimates (scalar values) of e.g. the mean or variance, we use probability distributions that quantify uncertainty. Point estimates Probability distributions
  • 13. Given 16 strategies, how to weight them?
  • 15. Bayesian Modeling: Coin flipping Parameters Prior p(θ) Likelihood p(x | θ) Model construction: How parameters relate to data Inference: Bayes Formula most likely parameters given data Data x (Heads / Tails) Parameters Posterior p(θ | x) p(heads) Observe: HTTHTTT belief
  • 16. Probabilistic Programming Parameters Prior p(θ) Likelihood p(x | θ) Model construction: How parameters relate to data Inference: Bayes Formula most likely parameters given data Data x (Heads / Tails) Parameters Posterior p(θ | x) p(heads) Observe: HTTHTTT belief code a u t o m a t i c ( M C M C )
  • 17. T-Distribution Modeling financial returns Inference: Bayes Formula probability of parameters given data Latent causes (Parameters) Distribution of Data Observed Data ● mean returns ● volatility ● tails
  • 19. ● Probabilistic Programming framework for Python, FOSS ● Specify arbitrary models in code by plugging probability distributions into each other ● Intuitive model specification syntax ○ For example: x ~ N(0,1) translates to x = Normal('x', 0, 1) ● Inference Button: Automatic and powerful inference for any model
  • 20. The model in Parameters / Priors Inference Model specification
  • 22. Posterior probability that strategy is profitable (SR > 0)
  • 24. Bayesian Decision Making ● So far we only have probability distributions for our strategies. ● How to construct a portfolio from them? ● Use model to generate all kinds of possible future scenarios (prediction) ● Define loss function that rates how good a solution is given a scenario ● Use optimizer to find best solution across all possible future scenarios
  • 26. Predictions ● Generate possible future scenarios by drawing parameter set from posterior & sampling from likelihood ● Two sources of variability: Likelihood & uncertainty
  • 28. Loss function for Mean-Variance ● Utility theory tells us to minimize our expected losses (maximizing wins leads to overly risky behavior) ● Black-Littermann: −exp(−λr(ω)), where r(ω) are the expected returns if we used portfolio weights ω, λ is how averse to losses we are
  • 29. Example def loss_function(ω): # weight vector, e.g. [1/16, 1/16, …] loss = 0 for r in sampled_returns: # compute portfolio returns port_rets = sum(r * ω) loss += -exp(-port_rets) return loss
  • 31. Optimization → Output ● Finds optimal portfolio weights ω which minimize expected loss ● In our case: loss function is convex so we can use convex solvers (cvxpy) which are much faster, otherwise, use scipy.optimizer.fmin().
  • 32. The full model ● Changes in volatility and mean over time using GPs ● Hierarchical estimation to pool information from batch of algorithms ● Correlations
  • 33. Benefits ● Robust due to using posterior distributions rather than point-estimates ● Different length track-records are automatically handled ○ Short but great track-record: high uncertainty -> many potentially bad outcomes -> low weight ● Model can be improved to include all kinds of structure, like risk-factors, prior information we might have (e.g. knowing a certain manager well).
  • 34. Further reading www.pymc-labs.io @twiecki https://docs.pymc.io Bayesian Decision Making blog post: https://twiecki.io/blog/2019/01/14/supply_chain/
  • 35. 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.