pdstools.impactanalyzer

Submodules

Classes

Package Contents

class ImpactAnalyzer(raw_data: polars.LazyFrame)
Parameters:

raw_data (polars.LazyFrame)

ia_data: polars.LazyFrame
default_ia_experiments
default_ia_controlgroups
plot
classmethod from_pdc(pdc_source: os.PathLike | str | dict, *, query: pdstools.utils.types.QUERY | None = None, return_input_df: bool | None = False, return_df: bool | None = False)

Create an ImpactAnalyzer instance from a PDC file

Parameters:
  • pdc_filename (Union[os.PathLike, str]) – The full path to the PDC file

  • query (Optional[QUERY], optional) – An optional argument to filter out selected data, by default None

  • return_input_df (Optional[QUERY], optional) – Debugging option to return the wide data from the raw JSON file as a DataFrame, by default False

  • return_df (Optional[QUERY], optional) – Returns the processed input data as a DataFrame. Multiple of these can be stacked up and used to initialize the ImpactAnalyzer class, by default False

  • pdc_source (Union[os.PathLike, str, dict])

Returns:

The properly initialized ImpactAnalyzer object

Return type:

ImpactAnalyzer

classmethod _from_pdc_json(json_data: dict, *, query: pdstools.utils.types.QUERY | None = None, return_input_df: bool | None = False, return_df: bool | None = False)

Internal method to create an ImpactAnalyzer instance from PDC JSON data

The PDC data is really structured as a list of expriments: control group A vs control group B. There is no explicit indicator whether the B’s are really the same customers or not. The PDC data also contains a lot of UI related information that is not necessary.

We turn this data into a series of control groups with just counts of impressions and accepts. This does need to assume a few implicit assumptions.

Parameters:
  • json_data (dict)

  • query (Optional[pdstools.utils.types.QUERY])

  • return_input_df (Optional[bool])

  • return_df (Optional[bool])

summary_by_channel() polars.LazyFrame

Summarization of the experiments in Impact Analyzer split by Channel.

Returns:

Summary across all running Impact Analyzer experiments as a dataframe with the following fields:

Channel Identification: - Channel: The channel name

Performance Metrics: - CTR_Lift Adaptive Models vs Random Propensity: Lift in Engagement when testing prioritization with just Adaptive Models vs just Random Propensity - CTR_Lift NBA vs No Levers: Lift in Engagement for the full NBA Framework as configured vs prioritization without levers (only p, V and C) - CTR_Lift NBA vs Only Eligibility Rules: Lift in Engagement for the full NBA Framework as configured vs Only Eligibility policies applied (no Applicability or Suitability, and prioritized with pVCL) - CTR_Lift NBA vs Propensity Only: Lift in Engagement for the full NBA Framework as configured vs prioritization with model propensity only (no V, C or L) - CTR_Lift NBA vs Random: Lift in Engagement for the full NBA Framework as configured vs a Random eligible action (all engagement policies but randomly prioritized) - Value_Lift Adaptive Models vs Random Propensity: Lift in Expected Value when testing prioritization with just Adaptive Models vs just Random Propensity - Value_Lift NBA vs No Levers: Lift in Expected Value for the full NBA Framework as configured vs prioritization without levers (only p, V and C) - Value_Lift NBA vs Only Eligibility Rules: Lift in Expected Value for the full NBA Framework as configured vs Only Eligibility policies applied (no Applicability or Suitability, and prioritized with pVCL) - Value_Lift NBA vs Propensity Only: Lift in Expected Value for the full NBA Framework as configured vs prioritization with model propensity only (no V, C or L) - Value_Lift NBA vs Random: Lift in Expected Value for the full NBA Framework as configured vs a Random eligible action (all engagement policies but randomly prioritized)

Return type:

pl.LazyFrame

overall_summary() polars.LazyFrame

Summarization of the experiments in Impact Analyzer.

Returns:

Summary across all running Impact Analyzer experiments as a dataframe with the following fields:

Performance Metrics: - CTR_Lift Adaptive Models vs Random Propensity: Lift in Engagement when testing prioritization with just Adaptive Models vs just Random Propensity - CTR_Lift NBA vs No Levers: Lift in Engagement for the full NBA Framework as configured vs prioritization without levers (only p, V and C) - CTR_Lift NBA vs Only Eligibility Rules: Lift in Engagement for the full NBA Framework as configured vs Only Eligibility policies applied (no Applicability or Suitability, and prioritized with pVCL) - CTR_Lift NBA vs Propensity Only: Lift in Engagement for the full NBA Framework as configured vs prioritization with model propensity only (no V, C or L) - CTR_Lift NBA vs Random: Lift in Engagement for the full NBA Framework as configured vs a Random eligible action (all engagement policies but randomly prioritized) - Value_Lift Adaptive Models vs Random Propensity: Lift in Expected Value when testing prioritization with just Adaptive Models vs just Random Propensity - Value_Lift NBA vs No Levers: Lift in Expected Value for the full NBA Framework as configured vs prioritization without levers (only p, V and C) - Value_Lift NBA vs Only Eligibility Rules: Lift in Expected Value for the full NBA Framework as configured vs Only Eligibility policies applied (no Applicability or Suitability, and prioritized with pVCL) - Value_Lift NBA vs Propensity Only: Lift in Expected Value for the full NBA Framework as configured vs prioritization with model propensity only (no V, C or L) - Value_Lift NBA vs Random: Lift in Expected Value for the full NBA Framework as configured vs a Random eligible action (all engagement policies but randomly prioritized)

Return type:

pl.LazyFrame

summarize_control_groups(by: List[str] | str | None = None, drop_internal_cols=True) polars.LazyFrame
Parameters:

by (Optional[Union[List[str], str]])

Return type:

polars.LazyFrame

summarize_experiments(by: List[str] | str | None = None) polars.LazyFrame
Parameters:

by (Optional[Union[List[str], str]])

Return type:

polars.LazyFrame