pdstools.impactanalyzer.Plots¶
Plotting utilities for Impact Analyzer visualization.
Attributes¶
Classes¶
Visualization methods for Impact Analyzer experiment data. |
Module Contents¶
- logger¶
- class Plots(ia: pdstools.impactanalyzer.ImpactAnalyzer.ImpactAnalyzer)¶
Bases:
pdstools.utils.namespaces.LazyNamespaceVisualization methods for Impact Analyzer experiment data.
This class provides plotting capabilities for analyzing Impact Analyzer experiment results. It is accessed through the plot attribute of an
ImpactAnalyzerinstance.All plot methods support: - Custom titles via title parameter - Data filtering via query parameter - Faceting by dimension via facet parameter - Returning underlying data via return_df=True
- Parameters:
- ia¶
Reference to the parent ImpactAnalyzer instance.
- Type:
See also
pdstools.impactanalyzer.ImpactAnalyzerMain analysis class.
Examples
>>> ia = ImpactAnalyzer.from_pdc("export.json") >>> ia.plot.overview() >>> ia.plot.trend(metric="Value_Lift", facet="Channel")
- ia¶
- static _get_experiment_color_map() List[str]¶
Get ordered list of experiment names for consistent coloring.
- Returns:
Alphabetically ordered list of default experiment names.
- Return type:
List[str]
- static _get_facet_config(data: polars.DataFrame, facet: str | None) dict¶
Determine optimal faceting configuration.
Automatically selects column wrapping based on the number of distinct facet values for better layout.
- overview(*, title: str | None = None, query: pdstools.utils.types.QUERY | None = None, metric: str = 'CTR_Lift', facet: str | None = None, return_df: bool = False) plotly.graph_objs.Figure | polars.LazyFrame¶
Create a bar chart comparing experiment performance.
Displays a horizontal bar chart comparing Impact Analyzer experiments for the specified lift metric.
- Parameters:
title (str, optional) – Custom title. If None, auto-generated from metric.
query (QUERY, optional) – Polars expression to filter the data.
metric (str, default "CTR_Lift") – Metric to display: “CTR_Lift” or “Value_Lift”.
facet (str, optional) – Column name for faceting (e.g., “Channel”).
return_df (bool, default False) – If True, return data as LazyFrame instead of figure.
- Returns:
Plotly figure, or LazyFrame if return_df=True.
- Return type:
Figure or pl.LazyFrame
See also
trendTime series of experiment metrics.
control_groups_trendTime series of control group metrics.
Examples
>>> ia.plot.overview() >>> ia.plot.overview(metric="Value_Lift", facet="Channel") >>> df = ia.plot.overview(return_df=True)
- control_groups_trend(*, title: str | None = None, query: pdstools.utils.types.QUERY | None = None, metric: str = 'CTR', facet: str | None = None, every: str | None = None, return_df: bool = False) plotly.graph_objs.Figure | polars.LazyFrame¶
Create a line chart of control group metrics over time.
Displays how different control groups perform over time for the specified metric.
- Parameters:
title (str, optional) – Custom title. If None, auto-generated from metric.
query (QUERY, optional) – Polars expression to filter the data.
metric (str, default "CTR") – Metric to display: “CTR” or “ValuePerImpression”.
facet (str, optional) – Column name for faceting (e.g., “Channel”).
every (str, optional) – Time aggregation period using Polars syntax: “1d” (daily), “1w” (weekly), “1mo” (monthly), etc.
return_df (bool, default False) – If True, return data as LazyFrame instead of figure.
- Returns:
Plotly figure, or LazyFrame if return_df=True.
- Return type:
Figure or pl.LazyFrame
Examples
>>> ia.plot.control_groups_trend() >>> ia.plot.control_groups_trend(metric="ValuePerImpression", every="1w") >>> ia.plot.control_groups_trend(facet="Channel", every="1mo")
- trend(*, title: str | None = None, query: pdstools.utils.types.QUERY | None = None, metric: str = 'CTR_Lift', facet: str | None = None, every: str | None = None, return_df: bool = False) plotly.graph_objs.Figure | polars.LazyFrame¶
Create a line chart of experiment lift metrics over time.
Displays how different experiments’ lift metrics evolve over time.
- Parameters:
title (str, optional) – Custom title. If None, auto-generated from metric.
query (QUERY, optional) – Polars expression to filter the data.
metric (str, default "CTR_Lift") – Metric to display: “CTR_Lift” or “Value_Lift”.
facet (str, optional) – Column name for faceting (e.g., “Channel”).
every (str, optional) – Time aggregation period using Polars syntax: “1d” (daily), “1w” (weekly), “1mo” (monthly), etc.
return_df (bool, default False) – If True, return data as LazyFrame instead of figure.
- Returns:
Plotly figure, or LazyFrame if return_df=True.
- Return type:
Figure or pl.LazyFrame
See also
overviewBar chart of experiment metrics.
control_groups_trendTime series of control group metrics.
Examples
>>> ia.plot.trend() >>> ia.plot.trend(metric="Value_Lift", every="1w") >>> ia.plot.trend(facet="Channel", every="1mo")