RTB Benchmarking API Documentation¶
rtb.bidding module¶
Bidding module
-
class
rtb.bidding.BidSimulator(data, bidding_strategy)[source]¶ Bases:
objectSimulates given bidding strategy on a dataset
Methods
-
__init__(data, bidding_strategy)[source]¶ Initialize bidding simulator.
Parameters: data : pandas.DataFrame
Historical data containing features for model predicti n, bidding price, winning price, impressions and click indicators.
bidding_strategy : func
Function that retuns bid given prospenity to click and data row
-
__weakref__¶ list of weak references to the object (if defined)
-
static
cpm(total_spendings, num_of_impressions)[source]¶ Calculate Cost Per Mille - total cost advertiser pays for 1000 impressions.
-
static
ctr(num_of_clicks, num_of_impressions)[source]¶ Claculate Click Through Rate - frequency of clicks on ads.
-
-
class
rtb.bidding.EffectiveCPCBiddingStrategy(data)[source]¶ Bases:
rtb.bidding.GoalBiddingStrategyBid based on prospenity and CPC calculated from training data
Methods
-
class
rtb.bidding.FlatBiddingStrategy(bid)[source]¶ Bases:
objectConstant bid
Methods
-
__call__(prospenity, row)[source]¶ Execute bidding strategy
Parameters: prospenity : float
prospenity to click
row : dict-like
data row with features, pricing, impression and click data
Returns: bid_price : float
-
__weakref__¶ list of weak references to the object (if defined)
-
-
class
rtb.bidding.GoalBiddingStrategy(bid)[source]¶ Bases:
objectBid based on prospenity
Methods
-
__call__(prospenity, row)[source]¶ Execute bidding strategy
Parameters: prospenity : float
prospenity to click
row : dict-like
data row with features, pricing, impression and click data
Returns: bid_price : float
-
__weakref__¶ list of weak references to the object (if defined)
-
-
class
rtb.bidding.RandomBiddingStrategy(bid)[source]¶ Bases:
objectRandom strategy that places random pertribations of a base bid
Methods
-
__call__(prospenity, row)[source]¶ Execute bidding strategy
Parameters: prospenity : float
prospenity to click
row : dict-like
data row with features, pricing, impression and click data
Returns: bid_price : float
-
__weakref__¶ list of weak references to the object (if defined)
-
-
class
rtb.bidding.RunResults(total_clicks, total_impressions, total_ad_spend)¶ Bases:
tupleAttributes
Methods
-
__getnewargs__()¶ Return self as a plain tuple. Used by copy and pickle.
-
static
__new__(_cls, total_clicks, total_impressions, total_ad_spend)¶ Create new instance of RunResults(total_clicks, total_impressions, total_ad_spend)
-
__repr__()¶ Return a nicely formatted representation string
-
_asdict()¶ Return a new OrderedDict which maps field names to their values.
-
classmethod
_make(iterable, new=<built-in method __new__ of type object>, len=<built-in function len>)¶ Make a new RunResults object from a sequence or iterable
-
_replace(_self, **kwds)¶ Return a new RunResults object replacing specified fields with new values
-
total_ad_spend¶ Alias for field number 2
-
total_clicks¶ Alias for field number 0
-
total_impressions¶ Alias for field number 1
-
rtb.data_reader module¶
Data reading modules
-
class
rtb.data_reader.ClicksReader(data_path)[source]¶ Bases:
rtb.data_reader.DataReaderIPinYou RTB clicks dataset loader. Expecting data from 2 or 3 competition (with additional columns)
Methods
-
class
rtb.data_reader.DataReader(data_path)[source]¶ Bases:
objectSequential data reader with ability to specify it’s own row parsing funtion.
Methods
-
__init__(data_path)[source]¶ Create data reader for IPinYou RTB dataset.
Parameters: data_path : str
Path to data file.
row_transformers : list of func
Functions that parse row of data and return feature array. Each transformer will be applied sequentially like t3(t2(t1(row)))
post_processor : func
Post processing function that takes transformed data list as input
-
__metaclass__¶ alias of
ABCMeta
-
__weakref__¶ list of weak references to the object (if defined)
-
-
class
rtb.data_reader.ImpressionsReader(data_path)[source]¶ Bases:
rtb.data_reader.DataReaderIPinYou RTB impressions Dataset loader. Expecting data from 2 or 3 competition (with additional columns)
Methods