SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Running Stan in
Production: Bayesian
Revenue Estimation
2018-08-29 StanCon
Markus Ojala
PhD, Chief Data Scientist
Smartly.io
@MarkusOjala
Implemented in early 2017:
https://www.smartly.io/blog/tutorial-how-we-productized-bay
esian-revenue-estimation-with-stan
Referred by Andrew Gelman in early 2018:
http://andrewgelman.com/2018/01/21/smartly-io-productize
d-bayesian-revenue-estimation-stan/
“It’s BDA come to life!“
“This sort of thing is exactly what we were hoping to see.”
Blog posts
1 billion spend
Managed yearly
We Make Online Advertising
Easy, Effective, And
Enjoyable
Facebook &
Instagram Partner
Use Case: Campaign Budget Allocation
Multi-Armed
Bandit
The number of pulls for a given lever should match
its actual probability of being the optimal lever
Sample from the posterior for the mean of each lever
Bayesian Bandits / Thompson sampling
Modeling results per spend
Separate revenue model into two parts
ROAS = revenue / cost
= revenue / conversions * conversions / cost
= revenue / conversions * 1 / CPA
ROAS = return on ad spend
CPA = cost per action
Existing model
● Lot of data
● Varies fast
● Big differences
New model
● Little data
● Varies slowly
● Small real differences
● Lot of random variation
● Use hierarchical model: Account -> Campaign -> Ad set
● Revenue follows usually a long-tailed distribution, use log-normal
● We observe only hourly aggregates: approximate by using
Fenton-Wilkinson log-normal approximation
Modeling the revenue per purchase
Stan!
Start with
simple model
Posterior predictive checks with +100 real data
Fix step-by-step, allow no exceptions
Simplified end-model
● Easy way to write Bayesian models and do inference
● But hard to get stable in production: limit the scope of the model
● Reparametrize, use reasonable informative priors and custom initialization
○ Solves most of the convergence issues
● Sampling does not scale: we use ADVI / variational inference approximation
○ Validate that you get same results with sampling and ADVI
○ Random initialization issues were solved by fixing ADVI parameters
● About 1000 daily runs and $1M scheduled with Celery, PyStan, monitoring
Learnings in productizing Stan
Results 1
Common case:
ad sets don’t
really differ
Results 2
Campaigns
differ, ad sets
not
Results 3
Lot of data
Ad sets differ
Thank you.
Markus.Ojala@smartly.io
Are you an expert in Bayesian
modelling? Join us!
https://www.smartly.io/careers
We observe only aggregates
Goal: estimate log-normal parameters for ad sets
Challenge: observation i is aggregate of multiple events ni
Solution: Estimate by another log-normal
Multilevel
Model
Account
Campaign
Ad set

Weitere ähnliche Inhalte

Was ist angesagt?

Goals and Goal Funnels | Presented by Justin Spencer of Analytics Pros
Goals and Goal Funnels | Presented by Justin Spencer of Analytics ProsGoals and Goal Funnels | Presented by Justin Spencer of Analytics Pros
Goals and Goal Funnels | Presented by Justin Spencer of Analytics Pros
Caleb Whitmore
 
Testing Strategies
Testing StrategiesTesting Strategies
Testing Strategies
HP2009
 

Was ist angesagt? (20)

(10-15-14) Lehigh Marketing 111 Lecture Materials
(10-15-14) Lehigh Marketing 111 Lecture Materials(10-15-14) Lehigh Marketing 111 Lecture Materials
(10-15-14) Lehigh Marketing 111 Lecture Materials
 
In-app offers monetization from basics to advanced technics based on Crazy Pa...
In-app offers monetization from basics to advanced technics based on Crazy Pa...In-app offers monetization from basics to advanced technics based on Crazy Pa...
In-app offers monetization from basics to advanced technics based on Crazy Pa...
 
Testing Makes Perfect: A Case Study in Onsite Optimizations
Testing Makes Perfect: A Case Study in Onsite OptimizationsTesting Makes Perfect: A Case Study in Onsite Optimizations
Testing Makes Perfect: A Case Study in Onsite Optimizations
 
8 Seconds Plugmedia
8 Seconds Plugmedia8 Seconds Plugmedia
8 Seconds Plugmedia
 
LTV Predictions: How do real-life companies use them & what can you learn fro...
LTV Predictions: How do real-life companies use them & what can you learn fro...LTV Predictions: How do real-life companies use them & what can you learn fro...
LTV Predictions: How do real-life companies use them & what can you learn fro...
 
Maximize Customer Value (Optimove @ Market King Meetup - August 26, 2014)
Maximize Customer Value (Optimove @ Market King Meetup - August 26, 2014)Maximize Customer Value (Optimove @ Market King Meetup - August 26, 2014)
Maximize Customer Value (Optimove @ Market King Meetup - August 26, 2014)
 
Michael Twomey, Silverpop - 'Building ROI'
Michael Twomey, Silverpop - 'Building ROI'Michael Twomey, Silverpop - 'Building ROI'
Michael Twomey, Silverpop - 'Building ROI'
 
Getting from 0-$100K/m in SaaS
Getting from 0-$100K/m in SaaSGetting from 0-$100K/m in SaaS
Getting from 0-$100K/m in SaaS
 
Ppc bbq 29.4.15
Ppc bbq 29.4.15Ppc bbq 29.4.15
Ppc bbq 29.4.15
 
15.02.2018
15.02.201815.02.2018
15.02.2018
 
Goals and Goal Funnels | Presented by Justin Spencer of Analytics Pros
Goals and Goal Funnels | Presented by Justin Spencer of Analytics ProsGoals and Goal Funnels | Presented by Justin Spencer of Analytics Pros
Goals and Goal Funnels | Presented by Justin Spencer of Analytics Pros
 
5 Pillars of PPC
5 Pillars of PPC5 Pillars of PPC
5 Pillars of PPC
 
Tom Lewis – CFO, IPA
Tom Lewis – CFO, IPATom Lewis – CFO, IPA
Tom Lewis – CFO, IPA
 
DMFA Package of the Year: amfAR
DMFA Package of the Year: amfARDMFA Package of the Year: amfAR
DMFA Package of the Year: amfAR
 
The Private Life of Mail at Advertising Week Europe - A critique by Les Binet...
The Private Life of Mail at Advertising Week Europe - A critique by Les Binet...The Private Life of Mail at Advertising Week Europe - A critique by Les Binet...
The Private Life of Mail at Advertising Week Europe - A critique by Les Binet...
 
Presentation OMExpo - mobile and acquisition email
Presentation OMExpo - mobile and acquisition emailPresentation OMExpo - mobile and acquisition email
Presentation OMExpo - mobile and acquisition email
 
Testing Strategies
Testing StrategiesTesting Strategies
Testing Strategies
 
Leveraging Content to Generate Leads: 3 simple tactics one company used to ac...
Leveraging Content to Generate Leads: 3 simple tactics one company used to ac...Leveraging Content to Generate Leads: 3 simple tactics one company used to ac...
Leveraging Content to Generate Leads: 3 simple tactics one company used to ac...
 
Measure what Matters - Outcomes
Measure what Matters - OutcomesMeasure what Matters - Outcomes
Measure what Matters - Outcomes
 
Going Beyond Loyalty Programs to Retain Your Customers – Optimove - GrowComme...
Going Beyond Loyalty Programs to Retain Your Customers – Optimove - GrowComme...Going Beyond Loyalty Programs to Retain Your Customers – Optimove - GrowComme...
Going Beyond Loyalty Programs to Retain Your Customers – Optimove - GrowComme...
 

Ähnlich wie Running Stan in Production: Bayesian Revenue Estimation

Lean advertising 101 - Paid Acquisition for Startups
Lean advertising 101 - Paid Acquisition for StartupsLean advertising 101 - Paid Acquisition for Startups
Lean advertising 101 - Paid Acquisition for Startups
Clément Delangue
 

Ähnlich wie Running Stan in Production: Bayesian Revenue Estimation (20)

Adventures in Business Analytics – Optimization and the Organization Garry, s...
Adventures in Business Analytics – Optimization and the Organization Garry, s...Adventures in Business Analytics – Optimization and the Organization Garry, s...
Adventures in Business Analytics – Optimization and the Organization Garry, s...
 
Introduction to cohort Analysis - MeasureCamp Paris
Introduction to cohort Analysis - MeasureCamp ParisIntroduction to cohort Analysis - MeasureCamp Paris
Introduction to cohort Analysis - MeasureCamp Paris
 
Sample v2
Sample v2Sample v2
Sample v2
 
The Analytics Lifecycle
The Analytics LifecycleThe Analytics Lifecycle
The Analytics Lifecycle
 
Lean advertising 101 - Paid Acquisition for Startups
Lean advertising 101 - Paid Acquisition for StartupsLean advertising 101 - Paid Acquisition for Startups
Lean advertising 101 - Paid Acquisition for Startups
 
The Google Analytics API and Analytics Canvas
The Google Analytics API and Analytics CanvasThe Google Analytics API and Analytics Canvas
The Google Analytics API and Analytics Canvas
 
Step by Step Guide to Revenue Growth
Step by Step Guide to Revenue GrowthStep by Step Guide to Revenue Growth
Step by Step Guide to Revenue Growth
 
Rapid Economic Justifcation for Machine Learning in IoT
Rapid Economic Justifcation for Machine Learning in IoTRapid Economic Justifcation for Machine Learning in IoT
Rapid Economic Justifcation for Machine Learning in IoT
 
Let’s make web analytics more customer centric!
Let’s make web analytics more customer centric!Let’s make web analytics more customer centric!
Let’s make web analytics more customer centric!
 
Lessons learned from 3k SaaS Companies - Patrick Campbell, CEO, Price Intelli...
Lessons learned from 3k SaaS Companies - Patrick Campbell, CEO, Price Intelli...Lessons learned from 3k SaaS Companies - Patrick Campbell, CEO, Price Intelli...
Lessons learned from 3k SaaS Companies - Patrick Campbell, CEO, Price Intelli...
 
Better Living Through Analytics - Strategies for Data Decisions
Better Living Through Analytics - Strategies for Data DecisionsBetter Living Through Analytics - Strategies for Data Decisions
Better Living Through Analytics - Strategies for Data Decisions
 
Intro to Data Analytics with Oscar's Director of Product
 Intro to Data Analytics with Oscar's Director of Product Intro to Data Analytics with Oscar's Director of Product
Intro to Data Analytics with Oscar's Director of Product
 
[Webinar] Innovate Faster by Adopting The Modern Growth Stack
[Webinar] Innovate Faster by Adopting The Modern Growth Stack[Webinar] Innovate Faster by Adopting The Modern Growth Stack
[Webinar] Innovate Faster by Adopting The Modern Growth Stack
 
Content marketing analytics: how to make your data work harder for your business
Content marketing analytics: how to make your data work harder for your businessContent marketing analytics: how to make your data work harder for your business
Content marketing analytics: how to make your data work harder for your business
 
Class 03: Introduction to Google Analytics
Class 03: Introduction to Google AnalyticsClass 03: Introduction to Google Analytics
Class 03: Introduction to Google Analytics
 
Social Media ROI: Formulas & Conversion Optimization Tips
Social Media ROI: Formulas & Conversion Optimization TipsSocial Media ROI: Formulas & Conversion Optimization Tips
Social Media ROI: Formulas & Conversion Optimization Tips
 
TradeSmart Case Studies
TradeSmart Case StudiesTradeSmart Case Studies
TradeSmart Case Studies
 
How to Use Data for Product Decisions by YouTube Product Manager
How to Use Data for Product Decisions by YouTube Product ManagerHow to Use Data for Product Decisions by YouTube Product Manager
How to Use Data for Product Decisions by YouTube Product Manager
 
GAUC 2020 - presentatie Hans en Reinier
GAUC 2020 - presentatie Hans en ReinierGAUC 2020 - presentatie Hans en Reinier
GAUC 2020 - presentatie Hans en Reinier
 
Spike - pitch deck
Spike - pitch deckSpike - pitch deck
Spike - pitch deck
 

Kürzlich hochgeladen

Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
HyderabadDolls
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
nirzagarg
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
Health
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
nirzagarg
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
gajnagarg
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
ahmedjiabur940
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Bertram Ludäscher
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
gajnagarg
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Klinik kandungan
 

Kürzlich hochgeladen (20)

Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubai
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
 
Aspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraAspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - Almora
 
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 

Running Stan in Production: Bayesian Revenue Estimation

  • 1. Running Stan in Production: Bayesian Revenue Estimation 2018-08-29 StanCon Markus Ojala PhD, Chief Data Scientist Smartly.io @MarkusOjala
  • 2. Implemented in early 2017: https://www.smartly.io/blog/tutorial-how-we-productized-bay esian-revenue-estimation-with-stan Referred by Andrew Gelman in early 2018: http://andrewgelman.com/2018/01/21/smartly-io-productize d-bayesian-revenue-estimation-stan/ “It’s BDA come to life!“ “This sort of thing is exactly what we were hoping to see.” Blog posts
  • 3. 1 billion spend Managed yearly We Make Online Advertising Easy, Effective, And Enjoyable Facebook & Instagram Partner
  • 4.
  • 5. Use Case: Campaign Budget Allocation
  • 7. The number of pulls for a given lever should match its actual probability of being the optimal lever Sample from the posterior for the mean of each lever Bayesian Bandits / Thompson sampling
  • 9. Separate revenue model into two parts ROAS = revenue / cost = revenue / conversions * conversions / cost = revenue / conversions * 1 / CPA ROAS = return on ad spend CPA = cost per action Existing model ● Lot of data ● Varies fast ● Big differences New model ● Little data ● Varies slowly ● Small real differences ● Lot of random variation
  • 10. ● Use hierarchical model: Account -> Campaign -> Ad set ● Revenue follows usually a long-tailed distribution, use log-normal ● We observe only hourly aggregates: approximate by using Fenton-Wilkinson log-normal approximation Modeling the revenue per purchase
  • 11. Stan!
  • 13. Posterior predictive checks with +100 real data
  • 14. Fix step-by-step, allow no exceptions
  • 16. ● Easy way to write Bayesian models and do inference ● But hard to get stable in production: limit the scope of the model ● Reparametrize, use reasonable informative priors and custom initialization ○ Solves most of the convergence issues ● Sampling does not scale: we use ADVI / variational inference approximation ○ Validate that you get same results with sampling and ADVI ○ Random initialization issues were solved by fixing ADVI parameters ● About 1000 daily runs and $1M scheduled with Celery, PyStan, monitoring Learnings in productizing Stan
  • 17. Results 1 Common case: ad sets don’t really differ
  • 19. Results 3 Lot of data Ad sets differ
  • 20. Thank you. Markus.Ojala@smartly.io Are you an expert in Bayesian modelling? Join us! https://www.smartly.io/careers
  • 21. We observe only aggregates Goal: estimate log-normal parameters for ad sets Challenge: observation i is aggregate of multiple events ni Solution: Estimate by another log-normal