Configuration

Handlers

Handlers provide a framework for specifiying the inputs to a simulation, critically providing validation checks for each handler that will notify the user if inputs validate global tolerances.

class pysimmmulator.param_handlers.ad_spend_parameters(campaign_spend_mean: int, campaign_spend_std: int, max_min_proportion_on_each_channel: dict)

Handler for loading in parameters used by simmmulate class to generate ad spend approximation. After init, this class will also preform logic checks for the values of the parameters. Also provided is a check function that when passed basic_params from input to simmmulate, will provide futher validation checks.

Parameters:
  • campaign_spend_mean (int) – The average amount of money spent on a campaign.

  • campaign_spend_std (int) – The standard deviation of money spent on a campaign

  • max_min_proportion_on_each_channel (dict) – Specifies the minimum and maximum percentages of total spend allocated to each channel.

campaign_spend_mean: int
campaign_spend_std: int
check(basic_params: basic_parameters)

Validates ad_spend parameters agianst previously constructed basic parameter values.

Parameters:

basic_params (basic_parameters) – Previously submitted parameters as required by the simmmulate class

max_min_proportion_on_each_channel: dict
class pysimmmulator.param_handlers.adstock_parameters(true_lambda_decay: dict, alpha_saturation: dict, gamma_saturation: dict)

Handler for loading in parameters used by simmmulate class to augment adstock data. Provided is a check function that when passed basic_params from input to simmmulate, will provide validation checks.

Parameters:
  • true_lambda_decay (dict) – Numbers between 0 and 1 specifying the lambda parameters for a geometric distribution for adstocking media variables.

  • alpha_saturation (dict) – Specifying alpha parameter of geometric distribution for applying diminishing returns to media variables

  • gamma_saturation (dict) – Between 0 and 1 specifying gamma parameter of geometric distribution for applying diminishing returns to media variables

alpha_saturation: dict
check(basic_params: basic_parameters)
gamma_saturation: dict
true_lambda_decay: dict
class pysimmmulator.param_handlers.baseline_parameters(basic_params: basic_parameters, base_p: int, trend_p: int, temp_var: int, temp_coef_mean: int, temp_coef_sd: int, error_std: int)

Handler for loading in parameters used by simmmulate class to generate a baseline of sales. After init, this class will also preform logic checks for the values of the parameters.

Parameters:
  • basic_params (basic_parameters) – Number of years you want to generate data for.

  • base_p (int) – Amount of baseline sales we get in a day (sales not due to ads)

  • trend_p (int) – How much baseline sales is going to grow over the whole period of our data.

  • temp_var (int) – How big the height of the sine function is for temperature – i.e. how much temperature varies (used to inject seasonality into our data)

  • temp_coef_mean (int) – The average of how important seasonality is in our data (the larger this number, the more important seasonality is for sales)

  • temp_coef_sd (int) – The standard deviation of how important seasonality is in our data (the larger this number, the more variable the importance of seasonality is for sales)

  • error_std (int) – Amount of statistical noise added to baseline sales (the larger this number, the noisier baseline sales will be).

base_p: int
basic_params: basic_parameters
error_std: int
temp_coef_mean: int
temp_coef_sd: int
temp_var: int
trend_p: int
class pysimmmulator.param_handlers.basic_parameters(years: int, channels_impressions: list[str], channels_clicks: list[str], frequency_of_campaigns: int, start_date: str, true_cvr: list = None, revenue_per_conv: float = None)

Handler for loading in basic parameters used by simmmulate class. After init, this class will also preform logic checks for the values of the parameters.

Parameters:
  • years (int) – Number of years you want to generate data for.

  • channels_impressions (list[int]) – names of media channels that use impressions as their metric of activity (Examples: Amazon, TV, etc)

  • channels_clicks (list[int]) – names of media channels that use clicks as their metric of activity (Examples: Search)

  • frequency_of_campaigns (int) – how often campaigns occur (for example, frequency of 1 would yield a new campaign every 1 day with each campaign lasting 1 day).

  • start_date (str) – format yyyy/mm/dd that determines when your daily data set starts on

  • true_cvr (list) – what the underlying conversion rates of all the channels are, statistical noise will be added on top of this.

  • revenue_per_conv (float) – How much money we make from a conversion (i.e. profit from a unit of sale).

channels_clicks: list[str]
channels_impressions: list[str]
evaluate_params()
frequency_of_campaigns: int
revenue_per_conv: float = None
start_date: str
true_cvr: list = None
years: int
class pysimmmulator.param_handlers.cvr_parameters(noisy_cvr: dict)

Handler for loading in parameters used by simmmulate class to generate cvr data. Provided is a check function that when passed basic_params from input to simmmulate, will provide validation checks.

Parameters:

noisy_cpm_cpc (dict) – Specifies the bias and scale of noise added to the true value CVR for each channel.

check(basic_params: basic_parameters)
noisy_cvr: dict
class pysimmmulator.param_handlers.media_parameters(true_cpm: dict, true_cpc: dict, noisy_cpm_cpc: dict)

Handler for loading in parameters used by simmmulate class to generate media data. After init, this class will also preform logic checks for the values of the parameters. Also provided is a check function that when passed basic_params from input to simmmulate, will provide futher validation checks.

Parameters:
  • true_cpm (dict) – Specifies the true Cost per Impression (CPM) of each channel (noise will be added to this to simulate number of impressions)

  • true_cpc (dict) – Specifies the true Cost per Click (CPC) of each channel (noise will be added to this to simulate number of clicks)

  • noisy_cpm_cpc (dict) – Specifies the bias and scale of noise added to the true value CPM or CPC for each channel.

check(basic_params: basic_parameters)
noisy_cpm_cpc: dict
true_cpc: dict
true_cpm: dict
class pysimmmulator.param_handlers.output_parameters(aggregation_level: str)

Handler for loading in parameters used by simmmulate class to generate final output data.

Parameters:

aggregation_level (str) – Specifies the aggregation level of final output data. choose between [daily, weekly].

aggregation_level: str

Loaders

Functions which automate steps within the parameter workflow. Most notably providing a load from file option load_config as well as a comprehensive validation function validate_config.

pysimmmulator.load_parameters.define_basic_params(years, channels_clicks, channels_impressions, frequency_of_campaigns, start_date, true_cvr, revenue_per_conv)

Takes in requirements for basic_params and loads with dataclass for validation as precursor

pysimmmulator.load_parameters.load_config(config_path: str) dict
pysimmmulator.load_parameters.validate_config(config_path: str, return_individual_results: bool = False)