pytyche.visual_confidence¶
Visual confidence payload for generator verification.
Provides a tested payload function that backs all panels of the visual confidence notebook. The notebook renders from the payload; unit tests assert on the payload directly without notebook rendering.
Public API¶
VisualConfidencePayload— frozen dataclass with required sections.build_visual_confidence_payload(bundle, bootstrap_seed, n_bootstrap=200) -> VisualConfidencePayload.
Functions
|
Build a VisualConfidencePayload from a CalibrationBundle. |
Classes
|
Typed payload backing all panels of the visual confidence notebook. |
- class pytyche.visual_confidence.VisualConfidencePayload(invariants, truth_summary, data_summary, recovery)[source]¶
Bases:
objectTyped payload backing all panels of the visual confidence notebook.
All four fields are required — there are no optional sections. Future analyzer/BCF panels extend this type by subclassing or by adding fields to a derived dataclass without breaking existing sections (open/closed principle for the payload contract).
- invariants¶
Name → bool map of generator contract checks.
- truth_summary¶
Population-level truth statistics.
- data_summary¶
Per-variant empirical summaries (variant name → stats).
- recovery¶
Empirical recovery comparison with planted truth and bootstrap SE on the empirical lift.
- Parameters:
invariants (
dict[str,bool])truth_summary (
dict[str,object])data_summary (
dict[str,dict[str,object]])recovery (
dict[str,object])
- pytyche.visual_confidence.build_visual_confidence_payload(bundle, bootstrap_seed, n_bootstrap=200)[source]¶
Build a VisualConfidencePayload from a CalibrationBundle.
Computes all panel data from the bundle:
invariants: 5 generator contract checks (all bool).truth_summary: planted effect, components, and per-visitor CATE stats.data_summary: per-variant empirical summaries (n_visitors, rates, revenue).recovery: planted effect, empirical lift, and bootstrap SE on lift.
- Parameters:
bundle (
CalibrationBundle) – CalibrationBundle fromgenerate_v2_core().bootstrap_seed (
int) – Seed for the bootstrap RNG — controls SE reproducibility.n_bootstrap (
int) – Number of bootstrap resamples. Default 200.
- Returns:
Frozen payload with all four required sections populated.
- Return type: