Categorical Rollup Design

Exact one-column categorical rollup design under saturated Q.

class updatesupport.rollup.CategoricalRollupCandidate(groups, public_cells, hidden_cells, observed_value, lower, upper, ambiguity, base_ambiguity, passes_bucket_budget, meets_ambiguity_limit, decision_invariant, decision_certified, certifies_claim)[source]

Bases: object

One exact categorical grouping evaluated under saturated Q.

Parameters:
groups: tuple[tuple[Hashable, ...], ...]
public_cells: int
hidden_cells: int
observed_value: float
lower: float
upper: float
ambiguity: float
base_ambiguity: float
passes_bucket_budget: bool
meets_ambiguity_limit: bool | None
decision_invariant: bool | None
decision_certified: bool | None
certifies_claim: bool
property group_count: int
property ambiguity_reduction: float
property ambiguity_reduction_percent: float
property category_mapping: dict[Hashable, int]
property label: str
as_dict()[source]
Return type:

dict[str, Any]

class updatesupport.rollup.CategoricalRollupDesign(claim, column, categories, output_column, max_groups, max_categories, bucket_budget, evaluated_partition_count, selected, base, best_by_group_count, frontier, status, title='Categorical Rollup Design', limitations=())[source]

Bases: ReportArtifactMixin

Exact reporting design over rollups of one categorical column.

Parameters:
claim: ClaimSpec
column: str
categories: tuple[Hashable, ...]
output_column: str
max_groups: int
max_categories: int
bucket_budget: int | None
evaluated_partition_count: int
selected: CategoricalRollupCandidate
base: CategoricalRollupCandidate
best_by_group_count: tuple[CategoricalRollupCandidate, ...]
frontier: tuple[CategoricalRollupCandidate, ...]
status: str
title: str = 'Categorical Rollup Design'
limitations: tuple[str, ...] = ()
property category_count: int
property uses_rollup_column: bool
property recommended_public: tuple[str, ...]
property selected_mapping: dict[Hashable, int]
property selected_claim: ClaimSpec

Return the claim configured for the selected rollup.

transform(data)[source]

Apply the selected intermediate rollup to row records.

Parameters:

data (Any)

Return type:

tuple[dict[str, Any], …]

audit(data, **kwargs)[source]

Audit data using the selected categorical rollup.

Parameters:
Return type:

ClaimAudit

as_dict()[source]
Return type:

dict[str, Any]

to_tables()[source]
Return type:

dict[str, tuple[dict[str, Any], …]]

to_markdown(*, max_frontier_rows=30)[source]
Parameters:

max_frontier_rows (int)

Return type:

str

updatesupport.rollup.design_categorical_rollup(data, claim, *, column, max_groups=None, max_categories=9, bucket_budget=None, output_column=None, tolerance=1e-09, title='Categorical Rollup Design')[source]

Design an exact global rollup of one categorical column.

Every set partition of the retained category levels up to max_groups is evaluated with the saturated public-fiber range formula. The selected design is the smallest budget-feasible rollup that certifies the claim, or the lowest-ambiguity budget-feasible design when no certifying rollup exists.

Parameters:
Return type:

CategoricalRollupDesign