pdstools.decision_analyzer.plots._distribution

Distribution-style plots: treemap, action variation, histograms, rank/parameter boxplots.

Functions

distribution_as_treemap(self, df, stage, scope_options)

action_variation(self[, stage, color_by, return_df])

Plot action variation (Lorenz curve showing action concentration).

distribution(self, df, scope, breakdown[, metric, ...])

rank_boxplot(self[, reference, return_df, ...])

create_parameter_distribution_boxplots(...)

Create box plots comparing parameter distributions between selected actions and others.

Module Contents

distribution_as_treemap(self, df: polars.LazyFrame, stage: str, scope_options: list[str])
Parameters:
  • df (polars.LazyFrame)

  • stage (str)

  • scope_options (list[str])

action_variation(self, stage='Final', color_by=None, return_df=False)

Plot action variation (Lorenz curve showing action concentration).

Args:

stage: Stage to analyze color_by: Optional dimension to color by (e.g., “Channel/Direction”) return_df: If True, return the data instead of the figure

distribution(self, df: polars.LazyFrame, scope: str, breakdown: str, metric: str = 'Decisions', horizontal=False)
Parameters:
  • df (polars.LazyFrame)

  • scope (str)

  • breakdown (str)

  • metric (str)

rank_boxplot(self, reference: polars.Expr | list[polars.Expr] | None = None, return_df=False, additional_filters=None)
Parameters:

reference (polars.Expr | list[polars.Expr] | None)

create_parameter_distribution_boxplots(segmented_df: polars.DataFrame, parameters: list[str] | None = None, title: str = 'Parameter Distributions: Selected Actions vs Competitors') plotly.graph_objects.Figure

Create box plots comparing parameter distributions between selected actions and others.

Parameters:
  • segmented_df (pl.DataFrame) – DataFrame with columns for parameters and a ‘segment’ column containing “Selected Actions” or “Others”

  • parameters (list[str], optional) – List of parameter column names to plot

  • title (str, optional) – Title for the plot

Returns:

Plotly figure with box plots

Return type:

go.Figure