Data Compilation¶
Tabular data compilers for finite update-support problems.
- class updatesupport.data.DataDiagnostic(code, severity, message, count=None, columns=(), public_value=None, hidden_cell=None, details=<factory>)[source]¶
Bases:
objectOne data preflight diagnostic emitted before solving.
- Parameters:
- class updatesupport.data.DataDiagnostics(rows_seen, total_weight, retained_weight, dropped_weight, hidden_cells, retained_hidden_cells, dropped_hidden_cells, public_cells, singleton_public_fibers, constant_public_fibers, diagnostics=())[source]¶
Bases:
objectPre-solve diagnostics for a compiled tabular problem.
- Parameters:
- diagnostics: tuple[DataDiagnostic, ...] = ()¶
- class updatesupport.data.GroupedProblem(problem, public_law, public_columns, hidden_columns, target_column, target_functional, total_weight, cell_weights, q=None, q_name='saturated', q_description='arbitrary reweighting among retained hidden cells inside each observed public cell', diagnostics=None, target_procedure=None, target_procedure_context=None, target_standard_error_column=None)[source]¶
Bases:
objectA finite problem compiled from grouped tabular observations.
- Parameters:
problem (FiniteProblem)
target_functional (LinearTarget | UncertainLinearTarget | RatioTarget)
total_weight (float)
q (QPreset | None)
q_name (str)
q_description (str)
diagnostics (DataDiagnostics | None)
target_procedure (ProcedureTarget | None)
target_procedure_context (ProcedureTargetContext | None)
- problem: FiniteProblem¶
- target_functional: LinearTarget | UncertainLinearTarget | RatioTarget¶
- q_description: str = 'arbitrary reweighting among retained hidden cells inside each observed public cell'¶
- diagnostics: DataDiagnostics | None = None¶
- target_procedure: ProcedureTarget | None = None¶
- target_procedure_context: ProcedureTargetContext | None = None¶
- to_report(**kwargs)[source]¶
Build a public-descent evidence report from this compiled problem.
- Parameters:
kwargs (Any)
- claim(estimate_name, **kwargs)[source]¶
Create a claim spec using this compiled problem’s metadata.
The returned spec can be verified against the original rows or, for a primary-interval-only audit, against this
GroupedProblem. Refinement and repair searches still need the original rows because they recompile alternate public representations.
- updatesupport.data.from_dataframe(data, *, public=None, hidden=None, target=None, target_standard_error=None, weight=None, public_columns=None, hidden_columns=None, target_column=None, target_standard_error_column=None, weight_column=None, min_cell_weight=1.0, q='saturated', q_radius=None, target_confidence_multiplier=1.96)[source]¶
Compile tabular observations into a finite update-support problem.
datamay be a pandas-like dataframe withto_dict("records")or an iterable of row mappings. Each hidden cell receives the weighted empirical mean oftargetas its estimand value. Iftargetis aProcedureTarget, the procedure is compiled once for the selected public representation and must return a column name orRowMetric. The returned problem uses an environment built from the selectedqpreset. The default isq="saturated", which fixes the observed public law and allows arbitrary reweighting inside retained public fibers.If
target_standard_erroris supplied, each hidden cell also receives a weighted-mean standard error under independent row-level target estimation errors. The compiled target remains linear in the hidden-cell point estimates, and reports can use the standard errors for estimator-uncertainty-aware interval adjustments.The
*_columnskeyword names are accepted as compatibility aliases forpublic,hidden,target, andweight.
Metric abstractions for plugin-provided target values.
- class updatesupport.metrics.RowMetric(name, func, columns=(), description='')[source]¶
Bases:
objectA row-level metric that can be used as a
from_dataframetarget.Domain extensions can return
RowMetricobjects to keep their domain-specific target logic outside the core package while still compiling to the same finite update-support problem.- Parameters:
- updatesupport.metrics.row_metric(name, func, *, columns=(), description='')[source]¶
Create a reusable row-level metric for
from_dataframe.
- updatesupport.metrics.target_name(target)[source]¶
Return the display name for a column or row metric target.