Skip to content

About

Python toolkit and applied methods preprint for routed confounder audits, combinatorial screening, signed cancellation, and exact hypergraph cuts.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

hypercancel

Python tools and companion applied methods preprint (Paper PDF) for auditing routed causal tables, screening three-way interactions, estimating signed factorial contrasts with non-ignorable proxy control variates, and certifying hypergraph cuts. The stages are usable separately. The package does not infer the assumptions of one stage from the output of another.

Install

With Python 3.11 or newer and uv, run this in a checkout:

uv sync --locked

Four-stage quickstart

Run uv run python verify/demo.py for four small, seeded examples. The demo source shows the inputs and calls for each stage.

0. Audit latent reach

Call audit_two_receiver_table(counts) on a routed switch with more than two upstream symbols. A population inequality violation excludes the stated reach cap in the routed graph, with no direct upstream-to-receiver arrow and no shared upstream-switch root. Nonviolation does not prove compatibility. Binarizing the upstream symbol erases the two-receiver separation. The calibrated two-read bound uses distinct known rates; given the true symbol, the reads must be independent of each other and of the decoded downstream symbol. Sample scores and percentile bootstrap intervals are not population certificates.

1. Screen candidates

Use select_basis_panel to choose a coverage panel, propagate_hyperedge_scores to transfer scores to unseen partners, and plan_round2_adaptive_risk to choose the next partners to measure. Panel selection is greedy. Blind ranking and acquisition are separate tasks. When training the ranker, supply features cross-fitted without access to held-out outcomes. The methods give no causal or discovery guarantee.

2. Cancel aliases

Call estimate_signed_cancellation with regime samples, a target, alias differences, and outcome bounds. In the demo, the signed estimate recovers a three-input coefficient despite a confounded passive moment.

Supply independent fresh randomization, a uniform reference law or exact joint density ratios, and all relevant alias differences. Optional controls require a stable pre-treatment proxy and an independent pilot. Active-only and common annihilated-alias features enter one weighted Ridge fit. This fit is not the oracle minimum-variance projection. Empirical Bernstein intervals require independent evaluation rows and valid global outcome and ratio bounds. Normal and Welch intervals are nominal.

3. Certify a split

Use solve_pinned_hypercut for the exact optimum with nonnegative rational weights and valid pins, and certify_box_optimality for worst-case regret. The box result applies to the supplied box. Population coverage requires simultaneous weight bounds.

Use verify_zonotope_certificate to check a sparse witness without an optimizer. The builder takes a full normalized submodular table and uses a bounded numerical LP search with exact checks. It is for small instances and can fail to construct a witness. Rank-three edges reduce to half-weight pairs. A positive seven-cut contrast on a four-block partition certifies rank at least four. A zero does not rule it out.

Stage 0 reach does not determine the experiment width in Stage 2 without a separate mapping to the factorial model. Stage 2 does not turn marginal intervals into a simultaneous Stage 3 box.

Verify

bash verify/run_all.sh

The verifier installs the locked package in a fresh temporary environment and runs the tests and demos on CPU under python -O. It prints pass/fail counts and exits nonzero on failure. After installation, uv run python -O tests/test_all_stages.py runs just the tests. The tests are also compatible with pytest.

Companion paper and hub

Cite, license, and disclosure

See CITATION.cff (released December 3, 2026; Zenodo version DOI 10.5281/zenodo.24771026, concept DOI 10.5281/zenodo.24771025). Code is MIT licensed; the paper in paper/ is CC BY 4.0. AI systems assisted with proof exploration, adversarial auditing, code verification, and prose editing. Chris Blaschke takes full responsibility for all claims and proofs.

About

Python toolkit and applied methods preprint for routed confounder audits, combinatorial screening, signed cancellation, and exact hypergraph cuts.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages