The Brains and the Brawn:
The Logic and Implementation of a
Redesigned Advertising Marketplace
pydata 2015
stephanie tzeng
salvatore rinchiera
what is online
advertising?
ONLINE ADVERTISING
USER
business cat
WEBSITE
(PUBLISHER)
litterboxes.com
AD
BOGO
LASER
POINTERS
APPNEXUS
•  Platform that connects advertisers and websites
•  Daily Volume:
•  120+ Billion Auctions
•  44 Billion Ads Served
•  170+ TB
•  Fill human brain capacity in 12 days
•  700 billion pages of printed information
•  40,000 miles of printed material
•  Reaches moon in 6.5 days
•  $273,000,000,000 in printing costs
BIG data
Have you
tried
atkins? 
medium data
I
M
P

B
U
S
AN
Bidder
log
HDFS
Data
Pipeline
Vertica
MySQL
impression
Bidder
Bidder
Bidder
Other
Bidders
Optimization
PERFORMANCE BUYING
Advertiser only pays
website when someone
buys lasers
Website accepts CPA
payment
BOGO
LASER
POINTERS
I’ll give you
$10 if
someone
clicks on my
ad
 k
BOGO
LASER
POINTERS
litterboxes.com
9
$5 /
click
$50/
purchase
$3 /
click
$7 /
click
$10 /
subscription
$9 /
click
$100/
purchase
$10/
purchase
$4 /
click
$.5 /
click
$13 /
click
$8/
purchase
 $5 /
click
$3 /
click
Uhhh…
litterboxes.com
OFFERS -> BID VALUES
•  Cost Per Click (CPC) = $10
•  Pr(Click) = 0.1
•  E(Imp) = $10 x 0.1 = $1
Pr(Click) = # of clicks / # of impressions
What happens when we have no data?
An Event = Information
•  Pr(Click) is crucial to expected value of an offer
•  Rare events like clicks hold much more information than having
impressions with no clicks
•  0 / 10 imps = 0 …
•  0 / 1000 imps = 0 …
•  0 / 10000 imps = 0 … still??
•  1 / 10000 … now we’re getting somewhere!
OFFER STATES
Offers are allocated into 2 different auction states
per website
•  Optimized State = Exploit. Capitalizing on
known information
•  Learn State = Explore. Acquiring new
information
In learn, there is no data. We estimate an initial
click or conversion probability to “buy” information.
IMPRESSIONS	
  
learn
auctions
optimized
auctions
OLD WORLD
•  Compute a predicted probability for all offer:website
combinations
•  Update this prediction as you gain information
•  Store all prediction combinations in memory
•  Problem: Elaborate probability prediction schemes are not
accurate enough, and you end up collecting real data very
slowly for all offers
A SINGLE BID IN LEARN
WEBSITE
offer
 learn valuation
instant ramen subscription
 3
quest bars
 3.5
bh farms carrot juice
 0.8
cholula hot sauce
 0.00001
starbucks oprah chai lattes
 2
justin bieber fanny pack
 0.000005
…
 …
recorder midi file download
 1.9
bidder memory
OFFER QUICK TEST
APPROACH
THE HYPOTHESIS
For information gathering, it is more cost effective to test out
“enough” impressions for a concentrated number of offers
than buying impressions for all offers based off a flawed
prediction.
RECALL: when working with rare events, the event holds the key
to your information.
You can use this event with limited impressions to classify an
offer as good or bad.
CLICK GOOD!
NO CLICK BAD!
QUICK-TEST
WHAT IS “ENOUGH”?
N impressions = the minimal amount of impressions you need to
deem an offer is bad (given no events).
Compute N impressions based on the offer’s payout (Goal), desired
conversion rate (p0), and our tolerance for false negatives (λ).
For each website, set
If p represents the “true” click through rate for offer:website, then
N = min(n) such that
QUICK-TEST
THE MATH
Bayes theorem tells us
So given an intelligent prior H(p) for p, we can solve for N from
QUICK-TEST
LAMBDA VS N
QUICK-TEST
lambda
(falsenegativerate)
N
1
0.5
Stop buying!
As you decrease your threshold
for false negatives, you are
more confident that this offer is
not good.
CHOOSING LAMBDA
ROC Curve
sensitivity
1 - specificity
Sensitivity =
= True Positive Rate
1 – Specificity = 1 – True Negative
Rate
=
= False Positive
Rate
ideal
OFFER STATE DIAGRAM
IMPLEMENTATION
Pre-rank offers for each seller unit based on predicted revenue
1. Rank
1.  offer ----
2.  offer ----
3.  offer ----
4.  offer ----
5.  offer ----
6.  offer ----
7.  offer ----
8.  offer ----
9.  offer ----
10.  offer ----
….
SELLER UNIT
Only top offers test at a time for learn auctions
2. Select Top Offers
1.  offer ----
2.  offer ----
3.  offer ----
4.  offer ----
5.  offer ----
6.  offer ----
7.  offer ----
8.  offer ----
9.  offer ----
10.  offer ----
….
SELLER UNIT
Each offer is given a chance to test.
As they “pass or fail,” they are quickly removed from the testing state
to give chance to other offers.
3. Quick-Test the Offers
offer ---- passed
offer ---- passed 
offer ---- passed
offer ---- failed
offer ---- failed
offer ---- failed
…
IMPRESSIONS	
  
learn
auctions
optimized
auctions
ad hell
RESULTS
Number of Offers
Bid Type
−− Learn
−− Optimized
RESULTS
Putting the Py in PyData
OFFER STATE DIAGRAM
Getting in the flow
Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Marketplace (Sponsor Talk)
•  Distribute computation across several machines
•  A large unit of work is called a job
•  Jobs are split into smaller units of work called tasks
•  Scheduler is responsible for kicking off job and splitting jobs into tasks
•  Task computation is carried out by worker machines
Distributed Work Queue
Job
task
task
task
task
•  In-house system implemented in Python
•  Scheduler and worker machines are listening on RabbitMQ
•  Similar to celery
•  Scheduler begins job when it receives notification on the exchange
•  Store job history and current status in MySQL
•  23 worker machines
Distributed Work Queue
RabbitMQ
1. Your data is ready!
2.
3.
4.
worker
worker
worker
Scheduler
Data
Pipeline
5.
RabbitMQ
•  Not interested in pushing broker service to the limit
•  10’s messages / second
•  Lots of flexibility with regard to routing rules
•  Fault tolerant
•  Clustering, federation, mirroring, message durability
•  Fantastic Python support with pika
•  Built in features that make it ideal for a work queue
•  Acking
•  Auto re-routing on failure
Vertica
Redis

HDFS
raw log
data
1.aggregate
3. transition
MySQL
Data flow
Bidder
Memory

4. sync
•  Stores log level data on every single impression
•  170+ TB / day
•  Great for large data sets
•  Fault tolerant
•  ~1400 machines
•  2 datacenters, NYM & LAX
Distributed Filesystem
Vertica
Redis

HDFS
raw log
data
1.aggregate
3. transition
MySQL
You are here.
Bidder
Memory

4. sync
Aggregate into Vertica
•  HP column store database
•  Fast aggregations!
•  Horizontally scaling
•  Supports frequent querying
•  ~150 Vertica nodes
Aggregation (Java)
Vertica
•  331,813,174,897 rows
Vertica
Redis

HDFS
raw log
data
1.aggregate
3. transition
MySQL
You are here.
Bidder
Memory

4. sync
$$$ing
•  Many processes need to access the same aggregated data
•  Can’t be querying Vertica constantly
Slicing + Dicing with Pandas
•  Represent rows and columns in memory
•  API supports complex row manipulation
•  Let pandas worry about performance for you! (mostly)
•  pyodbc + iopro under the hood
What do we cache?
• Websites with new data
•  If a website has new data, we’ll need to reevaluate which offers it is testing
• How many offers should be testing on each website at a time
•  AKA – Max Testing Offer
• Which offers allowed to serve on which countries / sizes?
• How many impressions / clicks / conversion on a website / offer
combination
•  Key-value store
•  Rich feature set
•  Sets
•  Hash set
•  Ordered set
•  Enforce best practices
•  Common layer to handle
serialization +
deserialization
•  Defined namespaces
•  redis-py API
Beware! Resource starvation
•  Apache Zookeeper + Kazoo to the rescue!
pls help,
I’m so
hungry
Vertica
Redis

HDFS
raw log
data
1.aggregate
3. transition
MySQL
You are here.
Bidder
Memory

4. sync
Load to MySQL with SqlAlchemy
•  After transition computation we write data to MySQL
•  SqlAlchemy to do writes
Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Marketplace (Sponsor Talk)
Vertica
Redis

HDFS
raw log
data
1.aggregate
3. transition
MySQL
You are here.
Bidder
Memory

4. sync
I
M
P

B
U
S
AN
Bidder
log
HDFS
Data
Pipeline
Vertica
MySQL
impression
Bidder
Bidder
Bidder
Other
Bidders
Optimization
Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Marketplace (Sponsor Talk)
WE’RE HIRING
THANK YOU

More Related Content

PPTX
Social Media Brand Positioning Workflow- David Gerson
PPTX
Danny Bickson - Python based predictive analytics with GraphLab Create
PPTX
Dataiku hadoop summit - semi-supervised learning with hadoop for understand...
PDF
Commercial Analytics at Scale in Pharma: From Hackathon to MVP with Azure Dat...
PPTX
Dataiku Flow and dctc - Berlin Buzzwords
PDF
Implementing and running a secure datalake from the trenches
PDF
Distributed Models Over Distributed Data with MLflow, Pyspark, and Pandas
PDF
Mastering Your Customer Data on Apache Spark by Elliott Cordo
Social Media Brand Positioning Workflow- David Gerson
Danny Bickson - Python based predictive analytics with GraphLab Create
Dataiku hadoop summit - semi-supervised learning with hadoop for understand...
Commercial Analytics at Scale in Pharma: From Hackathon to MVP with Azure Dat...
Dataiku Flow and dctc - Berlin Buzzwords
Implementing and running a secure datalake from the trenches
Distributed Models Over Distributed Data with MLflow, Pyspark, and Pandas
Mastering Your Customer Data on Apache Spark by Elliott Cordo

What's hot (20)

PPTX
Graph representation learning to prevent payment collusion fraud
PDF
Big Data in Production: Lessons from Running in the Cloud
PDF
AI meets Big Data
PDF
Machine Data Analytics
PPTX
Data Science for Dummies - Data Engineering with Titanic dataset + Databricks...
PDF
AI Modernization at AT&T and the Application to Fraud with Databricks
PPTX
Infochimps + CloudCon: Infinite Monkey Theorem
PDF
Blue Pill/Red Pill: The Matrix of Thousands of Data Streams
PDF
Real-Time Machine Learning at Industrial scale (University of Oxford, 9th Oct...
PDF
Next Generation Hadoop Introduction
PDF
Building Custom Machine Learning Algorithms With Apache SystemML
PDF
Building a Just in Time Data Warehouse by Dan Morris and Jason Pohl
PDF
Bigdata Machine Learning Platform
PDF
Data analysis trend 2015 2016 v071
PDF
Democratizing Machine Learning: Perspective from a scikit-learn Creator
PDF
Horizon: Deep Reinforcement Learning at Scale
PPTX
Real time machine learning
PPTX
Hadoop and BigData - July 2016
PDF
The More the Merrier: Scaling Model Building Infrastructure at Zendesk
PDF
Track B-1 建構新世代的智慧數據平台
Graph representation learning to prevent payment collusion fraud
Big Data in Production: Lessons from Running in the Cloud
AI meets Big Data
Machine Data Analytics
Data Science for Dummies - Data Engineering with Titanic dataset + Databricks...
AI Modernization at AT&T and the Application to Fraud with Databricks
Infochimps + CloudCon: Infinite Monkey Theorem
Blue Pill/Red Pill: The Matrix of Thousands of Data Streams
Real-Time Machine Learning at Industrial scale (University of Oxford, 9th Oct...
Next Generation Hadoop Introduction
Building Custom Machine Learning Algorithms With Apache SystemML
Building a Just in Time Data Warehouse by Dan Morris and Jason Pohl
Bigdata Machine Learning Platform
Data analysis trend 2015 2016 v071
Democratizing Machine Learning: Perspective from a scikit-learn Creator
Horizon: Deep Reinforcement Learning at Scale
Real time machine learning
Hadoop and BigData - July 2016
The More the Merrier: Scaling Model Building Infrastructure at Zendesk
Track B-1 建構新世代的智慧數據平台
Ad

Viewers also liked (20)

PDF
Python resampling
PDF
Evolutionary Algorithms: Perfecting the Art of "Good Enough"
PPTX
Nipype
PDF
Robert Meyer- pypet
PPTX
Speed Without Drag by Saul Diez-Guerra PyData SV 2014
PDF
Dark Data: A Data Scientists Exploration of the Unknown by Rob Witoff PyData ...
PDF
Numba: Flexible analytics written in Python with machine-code speeds and avo...
PPTX
Crushing the Head of the Snake by Robert Brewer PyData SV 2014
PPT
Interactive Financial Analytics with Python & Ipython by Dr Yves Hilpisch
PDF
How Soon is Now: automatically extracting publication dates of news articles ...
POTX
Doing frequentist statistics with scipy
PDF
Faster Python Programs Through Optimization by Dr.-Ing Mike Muller
PDF
Fang Xu- Enriching content with Knowledge Base by Search Keywords and Wikidata
PDF
Low-rank matrix approximations in Python by Christian Thurau PyData 2014
PDF
Promoting a Data Driven Culture in a Microservices Environment
POTX
Making your code faster cython and parallel processing in the jupyter notebook
PDF
Large scale-ctr-prediction lessons-learned-florian-hartl
PDF
GraphGen: Conducting Graph Analytics over Relational Databases
PDF
Embracing the Monolith in Small Teams: Doubling down on python to move fast w...
PDF
Bayesian Network Modeling using Python and R
Python resampling
Evolutionary Algorithms: Perfecting the Art of "Good Enough"
Nipype
Robert Meyer- pypet
Speed Without Drag by Saul Diez-Guerra PyData SV 2014
Dark Data: A Data Scientists Exploration of the Unknown by Rob Witoff PyData ...
Numba: Flexible analytics written in Python with machine-code speeds and avo...
Crushing the Head of the Snake by Robert Brewer PyData SV 2014
Interactive Financial Analytics with Python & Ipython by Dr Yves Hilpisch
How Soon is Now: automatically extracting publication dates of news articles ...
Doing frequentist statistics with scipy
Faster Python Programs Through Optimization by Dr.-Ing Mike Muller
Fang Xu- Enriching content with Knowledge Base by Search Keywords and Wikidata
Low-rank matrix approximations in Python by Christian Thurau PyData 2014
Promoting a Data Driven Culture in a Microservices Environment
Making your code faster cython and parallel processing in the jupyter notebook
Large scale-ctr-prediction lessons-learned-florian-hartl
GraphGen: Conducting Graph Analytics over Relational Databases
Embracing the Monolith in Small Teams: Doubling down on python to move fast w...
Bayesian Network Modeling using Python and R
Ad

Similar to Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Marketplace (Sponsor Talk) (20)

PDF
Making the Most of Customer Data
PDF
Tweak Geeks #FOS15
PPT
Data flow in the data center
PPT
presentation slides
PDF
Franchise presentation
PPTX
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
PDF
Creating PostgreSQL-as-a-Service at Scale
PPT
Int'l Conference on Predictive APIs: RTB Optimizer presentation
PDF
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
PPTX
Breaking the oracle tie
PDF
Spark as part of a Hybrid RDBMS Architecture-John Leach Cofounder Splice Machine
PDF
Cassandra Day Denver 2014: Transitioning to Cassandra for an Already Giant Pr...
PPTX
Northeast PHP - High Performance PHP
PPTX
ConFoo Montreal - Approaches for application request throttling
PDF
From checkout-free to self-checkout
PDF
Stream Processing in Action
PDF
OLAP IN DATA MINING
PDF
Transactional Streaming: If you can compute it, you can probably stream it.
PDF
[2C6]Everyplay_Big_Data
Making the Most of Customer Data
Tweak Geeks #FOS15
Data flow in the data center
presentation slides
Franchise presentation
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
Creating PostgreSQL-as-a-Service at Scale
Int'l Conference on Predictive APIs: RTB Optimizer presentation
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
Breaking the oracle tie
Spark as part of a Hybrid RDBMS Architecture-John Leach Cofounder Splice Machine
Cassandra Day Denver 2014: Transitioning to Cassandra for an Already Giant Pr...
Northeast PHP - High Performance PHP
ConFoo Montreal - Approaches for application request throttling
From checkout-free to self-checkout
Stream Processing in Action
OLAP IN DATA MINING
Transactional Streaming: If you can compute it, you can probably stream it.
[2C6]Everyplay_Big_Data

More from PyData (20)

PDF
Michal Mucha: Build and Deploy an End-to-end Streaming NLP Insight System | P...
PDF
Unit testing data with marbles - Jane Stewart Adams, Leif Walsh
PDF
The TileDB Array Data Storage Manager - Stavros Papadopoulos, Jake Bolewski
PDF
Using Embeddings to Understand the Variance and Evolution of Data Science... ...
PDF
Deploying Data Science for Distribution of The New York Times - Anne Bauer
PPTX
Graph Analytics - From the Whiteboard to Your Toolbox - Sam Lerma
PPTX
Do Your Homework! Writing tests for Data Science and Stochastic Code - David ...
PDF
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
PDF
Mining dockless bikeshare and dockless scootershare trip data - Stefanie Brod...
PDF
Avoiding Bad Database Surprises: Simulation and Scalability - Steven Lott
PDF
Words in Space - Rebecca Bilbro
PDF
End-to-End Machine learning pipelines for Python driven organizations - Nick ...
PPTX
Pydata beautiful soup - Monica Puerto
PDF
1D Convolutional Neural Networks for Time Series Modeling - Nathan Janos, Jef...
PPTX
Extending Pandas with Custom Types - Will Ayd
PDF
Measuring Model Fairness - Stephen Hoover
PDF
What's the Science in Data Science? - Skipper Seabold
PDF
Applying Statistical Modeling and Machine Learning to Perform Time-Series For...
PDF
Solving very simple substitution ciphers algorithmically - Stephen Enright-Ward
PDF
The Face of Nanomaterials: Insightful Classification Using Deep Learning - An...
Michal Mucha: Build and Deploy an End-to-end Streaming NLP Insight System | P...
Unit testing data with marbles - Jane Stewart Adams, Leif Walsh
The TileDB Array Data Storage Manager - Stavros Papadopoulos, Jake Bolewski
Using Embeddings to Understand the Variance and Evolution of Data Science... ...
Deploying Data Science for Distribution of The New York Times - Anne Bauer
Graph Analytics - From the Whiteboard to Your Toolbox - Sam Lerma
Do Your Homework! Writing tests for Data Science and Stochastic Code - David ...
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
Mining dockless bikeshare and dockless scootershare trip data - Stefanie Brod...
Avoiding Bad Database Surprises: Simulation and Scalability - Steven Lott
Words in Space - Rebecca Bilbro
End-to-End Machine learning pipelines for Python driven organizations - Nick ...
Pydata beautiful soup - Monica Puerto
1D Convolutional Neural Networks for Time Series Modeling - Nathan Janos, Jef...
Extending Pandas with Custom Types - Will Ayd
Measuring Model Fairness - Stephen Hoover
What's the Science in Data Science? - Skipper Seabold
Applying Statistical Modeling and Machine Learning to Perform Time-Series For...
Solving very simple substitution ciphers algorithmically - Stephen Enright-Ward
The Face of Nanomaterials: Insightful Classification Using Deep Learning - An...

Recently uploaded (20)

PDF
Data Engineering Interview Questions & Answers Data Modeling (3NF, Star, Vaul...
PDF
OneRead_20250728_1808.pdfhdhddhshahwhwwjjaaja
PDF
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
PPTX
Lesson-01intheselfoflifeofthekennyrogersoftheunderstandoftheunderstanded
PDF
Optimise Shopper Experiences with a Strong Data Estate.pdf
PPTX
Managing Community Partner Relationships
PPTX
chrmotography.pptx food anaylysis techni
PDF
Microsoft 365 products and services descrption
PDF
Global Data and Analytics Market Outlook Report
PDF
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
PPTX
FMIS 108 and AISlaudon_mis17_ppt_ch11.pptx
PPTX
Business_Capability_Map_Collection__pptx
DOCX
Factor Analysis Word Document Presentation
PPT
DU, AIS, Big Data and Data Analytics.ppt
PPTX
IMPACT OF LANDSLIDE.....................
PDF
Navigating the Thai Supplements Landscape.pdf
PPT
statistic analysis for study - data collection
PDF
Data Engineering Interview Questions & Answers Batch Processing (Spark, Hadoo...
PPTX
modul_python (1).pptx for professional and student
PPTX
sac 451hinhgsgshssjsjsjheegdggeegegdggddgeg.pptx
Data Engineering Interview Questions & Answers Data Modeling (3NF, Star, Vaul...
OneRead_20250728_1808.pdfhdhddhshahwhwwjjaaja
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
Lesson-01intheselfoflifeofthekennyrogersoftheunderstandoftheunderstanded
Optimise Shopper Experiences with a Strong Data Estate.pdf
Managing Community Partner Relationships
chrmotography.pptx food anaylysis techni
Microsoft 365 products and services descrption
Global Data and Analytics Market Outlook Report
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
FMIS 108 and AISlaudon_mis17_ppt_ch11.pptx
Business_Capability_Map_Collection__pptx
Factor Analysis Word Document Presentation
DU, AIS, Big Data and Data Analytics.ppt
IMPACT OF LANDSLIDE.....................
Navigating the Thai Supplements Landscape.pdf
statistic analysis for study - data collection
Data Engineering Interview Questions & Answers Batch Processing (Spark, Hadoo...
modul_python (1).pptx for professional and student
sac 451hinhgsgshssjsjsjheegdggeegegdggddgeg.pptx

Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Marketplace (Sponsor Talk)

  • 1. The Brains and the Brawn: The Logic and Implementation of a Redesigned Advertising Marketplace pydata 2015 stephanie tzeng salvatore rinchiera
  • 4. APPNEXUS •  Platform that connects advertisers and websites •  Daily Volume: •  120+ Billion Auctions •  44 Billion Ads Served •  170+ TB •  Fill human brain capacity in 12 days •  700 billion pages of printed information •  40,000 miles of printed material •  Reaches moon in 6.5 days •  $273,000,000,000 in printing costs
  • 7. PERFORMANCE BUYING Advertiser only pays website when someone buys lasers Website accepts CPA payment BOGO LASER POINTERS
  • 8. I’ll give you $10 if someone clicks on my ad k BOGO LASER POINTERS litterboxes.com
  • 9. 9 $5 / click $50/ purchase $3 / click $7 / click $10 / subscription $9 / click $100/ purchase $10/ purchase $4 / click $.5 / click $13 / click $8/ purchase $5 / click $3 / click Uhhh… litterboxes.com
  • 10. OFFERS -> BID VALUES •  Cost Per Click (CPC) = $10 •  Pr(Click) = 0.1 •  E(Imp) = $10 x 0.1 = $1 Pr(Click) = # of clicks / # of impressions What happens when we have no data?
  • 11. An Event = Information •  Pr(Click) is crucial to expected value of an offer •  Rare events like clicks hold much more information than having impressions with no clicks •  0 / 10 imps = 0 … •  0 / 1000 imps = 0 … •  0 / 10000 imps = 0 … still?? •  1 / 10000 … now we’re getting somewhere!
  • 12. OFFER STATES Offers are allocated into 2 different auction states per website •  Optimized State = Exploit. Capitalizing on known information •  Learn State = Explore. Acquiring new information In learn, there is no data. We estimate an initial click or conversion probability to “buy” information. IMPRESSIONS   learn auctions optimized auctions
  • 13. OLD WORLD •  Compute a predicted probability for all offer:website combinations •  Update this prediction as you gain information •  Store all prediction combinations in memory •  Problem: Elaborate probability prediction schemes are not accurate enough, and you end up collecting real data very slowly for all offers
  • 14. A SINGLE BID IN LEARN WEBSITE offer learn valuation instant ramen subscription 3 quest bars 3.5 bh farms carrot juice 0.8 cholula hot sauce 0.00001 starbucks oprah chai lattes 2 justin bieber fanny pack 0.000005 … … recorder midi file download 1.9 bidder memory
  • 16. THE HYPOTHESIS For information gathering, it is more cost effective to test out “enough” impressions for a concentrated number of offers than buying impressions for all offers based off a flawed prediction. RECALL: when working with rare events, the event holds the key to your information. You can use this event with limited impressions to classify an offer as good or bad. CLICK GOOD! NO CLICK BAD! QUICK-TEST
  • 17. WHAT IS “ENOUGH”? N impressions = the minimal amount of impressions you need to deem an offer is bad (given no events). Compute N impressions based on the offer’s payout (Goal), desired conversion rate (p0), and our tolerance for false negatives (λ). For each website, set If p represents the “true” click through rate for offer:website, then N = min(n) such that QUICK-TEST
  • 18. THE MATH Bayes theorem tells us So given an intelligent prior H(p) for p, we can solve for N from QUICK-TEST
  • 19. LAMBDA VS N QUICK-TEST lambda (falsenegativerate) N 1 0.5 Stop buying! As you decrease your threshold for false negatives, you are more confident that this offer is not good.
  • 20. CHOOSING LAMBDA ROC Curve sensitivity 1 - specificity Sensitivity = = True Positive Rate 1 – Specificity = 1 – True Negative Rate = = False Positive Rate ideal
  • 23. Pre-rank offers for each seller unit based on predicted revenue 1. Rank 1.  offer ---- 2.  offer ---- 3.  offer ---- 4.  offer ---- 5.  offer ---- 6.  offer ---- 7.  offer ---- 8.  offer ---- 9.  offer ---- 10.  offer ---- …. SELLER UNIT
  • 24. Only top offers test at a time for learn auctions 2. Select Top Offers 1.  offer ---- 2.  offer ---- 3.  offer ---- 4.  offer ---- 5.  offer ---- 6.  offer ---- 7.  offer ---- 8.  offer ---- 9.  offer ---- 10.  offer ---- …. SELLER UNIT
  • 25. Each offer is given a chance to test. As they “pass or fail,” they are quickly removed from the testing state to give chance to other offers. 3. Quick-Test the Offers offer ---- passed offer ---- passed offer ---- passed offer ---- failed offer ---- failed offer ---- failed … IMPRESSIONS   learn auctions optimized auctions ad hell
  • 26. RESULTS Number of Offers Bid Type −− Learn −− Optimized
  • 28. Putting the Py in PyData
  • 32. •  Distribute computation across several machines •  A large unit of work is called a job •  Jobs are split into smaller units of work called tasks •  Scheduler is responsible for kicking off job and splitting jobs into tasks •  Task computation is carried out by worker machines Distributed Work Queue Job task task task task
  • 33. •  In-house system implemented in Python •  Scheduler and worker machines are listening on RabbitMQ •  Similar to celery •  Scheduler begins job when it receives notification on the exchange •  Store job history and current status in MySQL •  23 worker machines Distributed Work Queue
  • 34. RabbitMQ 1. Your data is ready! 2. 3. 4. worker worker worker Scheduler Data Pipeline 5.
  • 35. RabbitMQ •  Not interested in pushing broker service to the limit •  10’s messages / second •  Lots of flexibility with regard to routing rules •  Fault tolerant •  Clustering, federation, mirroring, message durability •  Fantastic Python support with pika •  Built in features that make it ideal for a work queue •  Acking •  Auto re-routing on failure
  • 37. •  Stores log level data on every single impression •  170+ TB / day •  Great for large data sets •  Fault tolerant •  ~1400 machines •  2 datacenters, NYM & LAX Distributed Filesystem
  • 39. Aggregate into Vertica •  HP column store database •  Fast aggregations! •  Horizontally scaling •  Supports frequent querying •  ~150 Vertica nodes Aggregation (Java)
  • 42. $$$ing •  Many processes need to access the same aggregated data •  Can’t be querying Vertica constantly
  • 43. Slicing + Dicing with Pandas •  Represent rows and columns in memory •  API supports complex row manipulation •  Let pandas worry about performance for you! (mostly) •  pyodbc + iopro under the hood
  • 44. What do we cache? • Websites with new data •  If a website has new data, we’ll need to reevaluate which offers it is testing • How many offers should be testing on each website at a time •  AKA – Max Testing Offer • Which offers allowed to serve on which countries / sizes? • How many impressions / clicks / conversion on a website / offer combination
  • 45. •  Key-value store •  Rich feature set •  Sets •  Hash set •  Ordered set •  Enforce best practices •  Common layer to handle serialization + deserialization •  Defined namespaces •  redis-py API
  • 46. Beware! Resource starvation •  Apache Zookeeper + Kazoo to the rescue! pls help, I’m so hungry
  • 48. Load to MySQL with SqlAlchemy •  After transition computation we write data to MySQL •  SqlAlchemy to do writes