ab-analysis-kit 0.1.2__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ab_analysis_kit-0.1.2/ab_analysis_kit.egg-info → ab_analysis_kit-0.2.0}/PKG-INFO +8 -8
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/README.md +7 -7
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0/ab_analysis_kit.egg-info}/PKG-INFO +8 -8
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/ab_analysis_kit.egg-info/SOURCES.txt +2 -1
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/__init__.py +1 -1
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/rules/cli.md +8 -3
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/rules/validate.md +10 -3
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/skills/abk-validate/SKILL.md +4 -2
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/commands/validate.py +31 -3
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/main.py +28 -3
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/base.py +150 -1
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/bootstrap/bootstrap.py +14 -7
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/bootstrap/ci.py +10 -2
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/bootstrap/paired_bootstrap.py +5 -5
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/bootstrap/poisson_bootstrap.py +10 -10
- ab_analysis_kit-0.2.0/abkit/stats/effects.py +355 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/parametric/cuped_ttest.py +77 -13
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/parametric/paired_cuped_ttest.py +3 -12
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/parametric/paired_ttest.py +68 -15
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/parametric/ratio_delta.py +84 -15
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/parametric/ttest.py +56 -13
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/parametric/ztest.py +87 -15
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/power.py +20 -2
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/samples.py +18 -5
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/sequential/confidence_sequence.py +77 -3
- ab_analysis_kit-0.2.0/abkit/tuning/assets/explore.js +177 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/tuning/server.py +2 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/family.py +453 -3
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/inject.py +70 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/runner.py +86 -10
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/scoring.py +543 -3
- ab_analysis_kit-0.2.0/abkit/validate/vector_resample.py +503 -0
- ab_analysis_kit-0.1.2/abkit/stats/effects.py +0 -141
- ab_analysis_kit-0.1.2/abkit/tuning/assets/explore.js +0 -177
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/LICENSE +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/MANIFEST.in +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/ab_analysis_kit.egg-info/dependency_links.txt +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/ab_analysis_kit.egg-info/entry_points.txt +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/ab_analysis_kit.egg-info/requires.txt +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/ab_analysis_kit.egg-info/top_level.txt +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/_output.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/CLAUDE.section.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/rules/experiments.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/rules/explore.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/rules/methods.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/rules/metrics.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/rules/overview.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/rules/plan.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/rules/project.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/skills/abk-explore/SKILL.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/skills/abk-feedback/SKILL.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/skills/abk-new-experiment/SKILL.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/skills/abk-new-metric/SKILL.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/skills/abk-plan/SKILL.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/skills/abk-setup-project/SKILL.md +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/commands/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/commands/_context.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/commands/clean.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/commands/explore.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/commands/init.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/commands/init_claude.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/commands/plan.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/commands/run.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/commands/test_report.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/commands/unlock.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/compute/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/compute/recompute_backend.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/config/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/config/discovery.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/config/experiment_config.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/config/method_config.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/config/metric_config.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/config/profile.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/config/project_config.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/config/validator.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/core/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/core/interval.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/core/models.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/core/period_planner.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/_sql_manager.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/clickhouse_manager.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/internal_tables/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/internal_tables/_aa_runs.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/internal_tables/_base.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/internal_tables/_experiments.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/internal_tables/_exposures.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/internal_tables/_maintenance.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/internal_tables/_results.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/internal_tables/_schema.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/internal_tables/_tasks.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/internal_tables/_unit_state.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/internal_tables/manager.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/manager.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/mysql_manager.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/postgres_manager.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/database/tables.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/loaders/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/loaders/exposure_loader.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/loaders/metric_loader.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/loaders/query_template.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/loaders/templates/abkit_assignment.jinja +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/notify/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/notify/base.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/notify/branding.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/notify/email.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/notify/factory.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/notify/mattermost.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/notify/mock.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/notify/slack.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/notify/telegram.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/notify/webhook.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/pipeline/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/pipeline/_types.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/pipeline/analyze.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/pipeline/driver.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/pipeline/enrich.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/pipeline/readout.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/planning/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/planning/sizing.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/reporting/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/reporting/assets/report.js +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/reporting/builder.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/reporting/calibration.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/reporting/html_report.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/accumulate.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/bootstrap/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/bootstrap/applier.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/bootstrap/engine.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/bootstrap/paired_post_normed_bootstrap.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/bootstrap/post_normed_bootstrap.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/correction.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/exceptions.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/factory.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/parametric/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/registry.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/result.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/rng.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/sequential/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/sequential/apply.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/sequential/mixture.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/stats/srm.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/tuning/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/tuning/config_writer.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/tuning/html.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/tuning/payload.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/tuning/recompute.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/tuning/session.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/utils/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/utils/datetime_utils.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/utils/env_interpolation.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/utils/json_utils.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/__init__.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/_types.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/load.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/panel.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/persistence.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/resample.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/result.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/validate/run_id.py +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/pyproject.toml +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/requirements.txt +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/setup.cfg +0 -0
- {ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ab-analysis-kit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A/B experiment analysis as declarative YAML + SQL
|
|
5
5
|
Author: ab-analysis-kit authors
|
|
6
6
|
License: MIT
|
|
@@ -76,22 +76,22 @@ stabilization chart), writes them to a clean warehouse table any BI can read, an
|
|
|
76
76
|
gives you a local cockpit to tune the analysis and a harness to prove your method is
|
|
77
77
|
actually calibrated.
|
|
78
78
|
|
|
79
|
-
> **Status: `0.
|
|
79
|
+
> **Status: `0.2.0` (Alpha) — release-ready** (milestones **M1–M7**; `0.1.2` is the
|
|
80
|
+
> latest published on PyPI, the `v0.2.0` tag/publish is the maintainer's pending step). The
|
|
80
81
|
> statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
|
|
81
|
-
> self-contained reports, `abk validate
|
|
82
|
-
> DX layer (`abk init-claude`, docs site,
|
|
83
|
-
>
|
|
82
|
+
> self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
|
|
83
|
+
> opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
|
|
84
|
+
> Prefect scaffolding) are all shipped. Docs: [abkit.pipelab.dev](https://abkit.pipelab.dev).
|
|
84
85
|
|
|
85
86
|
## Install
|
|
86
87
|
|
|
87
|
-
Once `0.1.0` is published to PyPI (a maintainer tags `v0.1.0`; until then install from
|
|
88
|
-
source — `pip install -e ".[dev]"`):
|
|
89
|
-
|
|
90
88
|
```bash
|
|
91
89
|
pip install ab-analysis-kit # Python 3.10+; add a DB extra for real data:
|
|
92
90
|
pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
|
|
93
91
|
```
|
|
94
92
|
|
|
93
|
+
(For `0.2.0` before its tag lands, install from source — `pip install -e ".[dev]"`.)
|
|
94
|
+
|
|
95
95
|
`abk --version` and `abk --help` work with no database driver; you can even lint a
|
|
96
96
|
config (`abk run --steps validate`) with no database at all. See the
|
|
97
97
|
[getting-started guide](https://abkit.pipelab.dev) for the full first run.
|
|
@@ -11,22 +11,22 @@ stabilization chart), writes them to a clean warehouse table any BI can read, an
|
|
|
11
11
|
gives you a local cockpit to tune the analysis and a harness to prove your method is
|
|
12
12
|
actually calibrated.
|
|
13
13
|
|
|
14
|
-
> **Status: `0.
|
|
14
|
+
> **Status: `0.2.0` (Alpha) — release-ready** (milestones **M1–M7**; `0.1.2` is the
|
|
15
|
+
> latest published on PyPI, the `v0.2.0` tag/publish is the maintainer's pending step). The
|
|
15
16
|
> statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
|
|
16
|
-
> self-contained reports, `abk validate
|
|
17
|
-
> DX layer (`abk init-claude`, docs site,
|
|
18
|
-
>
|
|
17
|
+
> self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
|
|
18
|
+
> opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
|
|
19
|
+
> Prefect scaffolding) are all shipped. Docs: [abkit.pipelab.dev](https://abkit.pipelab.dev).
|
|
19
20
|
|
|
20
21
|
## Install
|
|
21
22
|
|
|
22
|
-
Once `0.1.0` is published to PyPI (a maintainer tags `v0.1.0`; until then install from
|
|
23
|
-
source — `pip install -e ".[dev]"`):
|
|
24
|
-
|
|
25
23
|
```bash
|
|
26
24
|
pip install ab-analysis-kit # Python 3.10+; add a DB extra for real data:
|
|
27
25
|
pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
|
|
28
26
|
```
|
|
29
27
|
|
|
28
|
+
(For `0.2.0` before its tag lands, install from source — `pip install -e ".[dev]"`.)
|
|
29
|
+
|
|
30
30
|
`abk --version` and `abk --help` work with no database driver; you can even lint a
|
|
31
31
|
config (`abk run --steps validate`) with no database at all. See the
|
|
32
32
|
[getting-started guide](https://abkit.pipelab.dev) for the full first run.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ab-analysis-kit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A/B experiment analysis as declarative YAML + SQL
|
|
5
5
|
Author: ab-analysis-kit authors
|
|
6
6
|
License: MIT
|
|
@@ -76,22 +76,22 @@ stabilization chart), writes them to a clean warehouse table any BI can read, an
|
|
|
76
76
|
gives you a local cockpit to tune the analysis and a harness to prove your method is
|
|
77
77
|
actually calibrated.
|
|
78
78
|
|
|
79
|
-
> **Status: `0.
|
|
79
|
+
> **Status: `0.2.0` (Alpha) — release-ready** (milestones **M1–M7**; `0.1.2` is the
|
|
80
|
+
> latest published on PyPI, the `v0.2.0` tag/publish is the maintainer's pending step). The
|
|
80
81
|
> statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
|
|
81
|
-
> self-contained reports, `abk validate
|
|
82
|
-
> DX layer (`abk init-claude`, docs site,
|
|
83
|
-
>
|
|
82
|
+
> self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
|
|
83
|
+
> opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
|
|
84
|
+
> Prefect scaffolding) are all shipped. Docs: [abkit.pipelab.dev](https://abkit.pipelab.dev).
|
|
84
85
|
|
|
85
86
|
## Install
|
|
86
87
|
|
|
87
|
-
Once `0.1.0` is published to PyPI (a maintainer tags `v0.1.0`; until then install from
|
|
88
|
-
source — `pip install -e ".[dev]"`):
|
|
89
|
-
|
|
90
88
|
```bash
|
|
91
89
|
pip install ab-analysis-kit # Python 3.10+; add a DB extra for real data:
|
|
92
90
|
pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
|
|
93
91
|
```
|
|
94
92
|
|
|
93
|
+
(For `0.2.0` before its tag lands, install from source — `pip install -e ".[dev]"`.)
|
|
94
|
+
|
|
95
95
|
`abk --version` and `abk --help` work with no database driver; you can even lint a
|
|
96
96
|
config (`abk run --steps validate`) with no database at all. See the
|
|
97
97
|
[getting-started guide](https://abkit.pipelab.dev) for the full first run.
|
|
@@ -10,7 +10,7 @@ from __future__ import annotations
|
|
|
10
10
|
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
13
|
-
__version__ = "0.
|
|
13
|
+
__version__ = "0.2.0"
|
|
14
14
|
|
|
15
15
|
#: Symbols re-exported lazily from ``abkit.stats`` (PEP 562) so importing
|
|
16
16
|
#: ``abkit`` for ``__version__`` (the CLI path) stays numpy-free and fast.
|
|
@@ -124,8 +124,8 @@ re-run `abk run` afterward to recompute under the new config. Full reference:
|
|
|
124
124
|
|
|
125
125
|
```bash
|
|
126
126
|
abk validate [--select <exp>] [--method <m>]... [--metric <m>] [--iterations N] \
|
|
127
|
-
[--inject-effect PCT] [--scoring fpr|power|mde]
|
|
128
|
-
[--force] [--profile NAME]
|
|
127
|
+
[--family-sweep] [--inject-effect PCT] [--scoring fpr|power|mde] \
|
|
128
|
+
[--report [PATH]] [--force] [--profile NAME]
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
The A/A false-positive + power **matrix** — placebo label-permutation splits on
|
|
@@ -140,7 +140,12 @@ calibration chip.
|
|
|
140
140
|
- `--method / -m` (repeatable) — score EXTRA registered methods beyond the declared
|
|
141
141
|
comparison (the method-grid axis; see the selector model above).
|
|
142
142
|
- `--metric` — validate only this metric (default: every declared comparison).
|
|
143
|
-
- `--iterations / -n`
|
|
143
|
+
- `--iterations / -n` — placebo A/A splits per cell (default: auto,
|
|
144
|
+
`max(2000, ⌈200/α⌉)` at each cell's effective alpha; an explicit N overrides
|
|
145
|
+
every cell).
|
|
146
|
+
- `--family-sweep` — also run the composed multi-metric FWER/FDR sweep (D9);
|
|
147
|
+
roughly doubles the cost. Opt-in since 0.2.0 (it used to auto-run whenever
|
|
148
|
+
`--metric` was omitted).
|
|
144
149
|
- `--inject-effect PCT` — inject a relative effect (e.g. `0.05`) to measure
|
|
145
150
|
power / achieved MDE / coverage.
|
|
146
151
|
- `--scoring fpr|power|mde` (default `fpr`) — the objective for the "Recommended"
|
|
@@ -28,7 +28,9 @@ shuffle is in-memory only; it never touches the real assignment.
|
|
|
28
28
|
labels destroys any true treatment effect → an **exact null** by construction (the
|
|
29
29
|
standard permutation-A/A), while still exercising the real grid, cadence, cohort,
|
|
30
30
|
and metric SQL.
|
|
31
|
-
3. **A/A (false-positive):** repeat N times (default
|
|
31
|
+
3. **A/A (false-positive):** repeat N times (default since 0.2.0: auto per cell,
|
|
32
|
+
`max(2000, ⌈200/α⌉)` at the cell's effective alpha — ≈4000 at 5%, ≈40000 at
|
|
33
|
+
0.5%; `-n` overrides every cell, auto-N >100k warns but never caps); each split runs the
|
|
32
34
|
candidate method(s) and records whether it *falsely* rejects H₀ at the effective
|
|
33
35
|
α. **FPR** = share of placebo runs that flagged significance. The significance
|
|
34
36
|
primitive is the readout's own **CI-excludes-zero** rule, not the raw `reject`
|
|
@@ -87,6 +89,9 @@ metrics under one shared assignment, corrected by two-tier Bonferroni (compute-t
|
|
|
87
89
|
error rate** (any false rejection across the family) and **false-discovery rate**
|
|
88
90
|
(mean false fraction among rejections) over one shared union-cohort placebo
|
|
89
91
|
assignment per iteration, under the *same* composed rule the readout applies.
|
|
92
|
+
**Opt-in since 0.2.0 via `--family-sweep`** (it roughly doubles the run; before
|
|
93
|
+
0.2.0 it always ran when `--metric` was omitted — a bare multi-metric run now
|
|
94
|
+
prints a one-release notice instead).
|
|
90
95
|
|
|
91
96
|
On the complete null the two coincide (every rejection is false) and sit at the
|
|
92
97
|
composed rule's **nominal rate** — ≈ α *per tier*, so ≈ 2α whole-family under the
|
|
@@ -104,7 +109,8 @@ family level. (Only `alpha_spending`/group-sequential stays a future item.)
|
|
|
104
109
|
|
|
105
110
|
```bash
|
|
106
111
|
abk validate --select <exp> [--method <m>]... [--metric <m>] [--iterations N] \
|
|
107
|
-
[--inject-effect <rel>] [--scoring fpr|power|mde]
|
|
112
|
+
[--family-sweep] [--inject-effect <rel>] [--scoring fpr|power|mde] \
|
|
113
|
+
[--report] [--force] [--profile]
|
|
108
114
|
```
|
|
109
115
|
|
|
110
116
|
| Flag | Meaning |
|
|
@@ -112,7 +118,8 @@ abk validate --select <exp> [--method <m>]... [--metric <m>] [--iterations N] \
|
|
|
112
118
|
| `--select`, `-s` | Experiment selector (name / glob / `tag:<tag>` / `*`; repeatable, default all). |
|
|
113
119
|
| `--method`, `-m` | **Extra** registered method(s) to score **beyond** the declared comparison — this is the method-grid axis (repeatable). NOT `--select`. |
|
|
114
120
|
| `--metric` | Validate only this metric (default: every declared comparison). |
|
|
115
|
-
| `--iterations`, `-n` | Placebo A/A splits per cell (default 2000).
|
|
121
|
+
| `--iterations`, `-n` | Placebo A/A splits per cell (default: auto, `max(2000, ⌈200/α⌉)` per cell's effective alpha). An explicit N overrides every cell. |
|
|
122
|
+
| `--family-sweep` | Also run the composed multi-metric FWER/FDR sweep (D9) — roughly doubles the cost. Opt-in since 0.2.0. |
|
|
116
123
|
| `--inject-effect` | Inject this **relative** effect (e.g. `0.05`) to measure power / achieved MDE / coverage. |
|
|
117
124
|
| `--scoring` | `fpr` (default) / `power` / `mde` — the objective for the **"Recommended" row only**. All columns are always computed regardless. |
|
|
118
125
|
| `--report` | Emit a self-contained HTML matrix report (best-effort). Bare → `reports/<exp>__validate.html`; a dir or `.html` path overrides. |
|
{ab_analysis_kit-0.1.2 → ab_analysis_kit-0.2.0}/abkit/cli/assets/claude/skills/abk-validate/SKILL.md
RENAMED
|
@@ -43,7 +43,8 @@ schema, the sequential/composed columns, budget-band resolution).
|
|
|
43
43
|
## Step 1 — Run validate
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
abk validate --select <exp> # every declared comparison,
|
|
46
|
+
abk validate --select <exp> # every declared comparison, auto N = max(2000, ceil(200/alpha)) per cell
|
|
47
|
+
abk validate --select <exp> --family-sweep # + the composed multi-metric FWER/FDR sweep (opt-in since 0.2.0)
|
|
47
48
|
abk validate --select <exp> --metric <m> # one metric only
|
|
48
49
|
abk validate --select <exp> --method z-test # score an EXTRA method beyond the declared one
|
|
49
50
|
abk validate --select <exp> --iterations 500 # quick look (looser FPR estimate)
|
|
@@ -55,7 +56,8 @@ abk validate --select <exp> --inject-effect 0.05 # also measure power / achi
|
|
|
55
56
|
| `--select`, `-s` | Experiment selector (name / glob / `tag:<tag>` / `*`; repeatable, default all). |
|
|
56
57
|
| `--method`, `-m` | **Extra** registered method(s) to score **beyond** the declared comparison — the method-grid axis (repeatable). Not a selector. |
|
|
57
58
|
| `--metric` | Validate only this metric (default: every declared comparison). |
|
|
58
|
-
| `--iterations`, `-n` | Placebo A/A splits per cell (default 2000).
|
|
59
|
+
| `--iterations`, `-n` | Placebo A/A splits per cell (default: auto, `max(2000, ⌈200/α⌉)` at each cell's effective alpha). An explicit N overrides every cell. |
|
|
60
|
+
| `--family-sweep` | Also run the composed multi-metric FWER/FDR sweep — roughly doubles the cost. Opt-in since 0.2.0 (previously always ran when `--metric` was omitted). |
|
|
59
61
|
| `--inject-effect` | Inject this **relative** effect (e.g. `0.05`) to measure power / achieved MDE / coverage. Without it, only FPR/peeking compute. |
|
|
60
62
|
| `--scoring` | `fpr` (default) / `power` / `mde` — the objective for the **"Recommended" row only**. All columns compute regardless. |
|
|
61
63
|
| `--report` | Emit a self-contained HTML matrix (best-effort). Bare → `reports/<exp>__validate.html`; a dir or `.html` path overrides. |
|
|
@@ -57,12 +57,14 @@ def run_validate(
|
|
|
57
57
|
select: tuple[str, ...],
|
|
58
58
|
method: tuple[str, ...],
|
|
59
59
|
metric: str | None,
|
|
60
|
-
iterations: int,
|
|
60
|
+
iterations: int | None,
|
|
61
61
|
inject_effect: float | None,
|
|
62
62
|
scoring: str,
|
|
63
63
|
report_path: str | None,
|
|
64
64
|
force: bool,
|
|
65
65
|
profile: str | None,
|
|
66
|
+
*,
|
|
67
|
+
family_sweep: bool = False,
|
|
66
68
|
) -> None:
|
|
67
69
|
context = load_project_context(require_profiles=True)
|
|
68
70
|
click.echo(f"Project root: {context.root}")
|
|
@@ -107,6 +109,7 @@ def run_validate(
|
|
|
107
109
|
scoring,
|
|
108
110
|
report_path,
|
|
109
111
|
force,
|
|
112
|
+
family_sweep,
|
|
110
113
|
)
|
|
111
114
|
if status == "failed":
|
|
112
115
|
failed += 1
|
|
@@ -127,6 +130,7 @@ def _validate_one(
|
|
|
127
130
|
scoring,
|
|
128
131
|
report_path,
|
|
129
132
|
force,
|
|
133
|
+
family_sweep,
|
|
130
134
|
) -> str:
|
|
131
135
|
from abkit.compute.recompute_backend import RecomputeBackend
|
|
132
136
|
from abkit.database.internal_tables import InternalTablesManager
|
|
@@ -174,9 +178,17 @@ def _validate_one(
|
|
|
174
178
|
extra_methods = [MethodConfig(name=name) for name in method_names]
|
|
175
179
|
metric_sqls = {cfg.name: cfg.get_query_text(context.root) for _, cfg in context.metrics}
|
|
176
180
|
settings = ValidateSettings(
|
|
177
|
-
iterations=iterations,
|
|
181
|
+
iterations=iterations,
|
|
182
|
+
inject_effect=inject_effect,
|
|
183
|
+
mode=scoring,
|
|
184
|
+
family_sweep=family_sweep,
|
|
178
185
|
)
|
|
179
|
-
|
|
186
|
+
splits = (
|
|
187
|
+
f"{iterations} placebo splits/cell"
|
|
188
|
+
if iterations is not None
|
|
189
|
+
else "auto placebo splits/cell: max(2000, ceil(200/alpha)) at each cell's alpha"
|
|
190
|
+
)
|
|
191
|
+
renderer("resample", splits)
|
|
180
192
|
|
|
181
193
|
result = run_validation(
|
|
182
194
|
backend,
|
|
@@ -199,6 +211,22 @@ def _validate_one(
|
|
|
199
211
|
renderer("persist", f"{len(records)} _ab_aa_runs row(s)")
|
|
200
212
|
|
|
201
213
|
_emit_matrix(experiment.name, result)
|
|
214
|
+
# the §4.1 warn-uncapped safeguard must reach the terminal, not just the
|
|
215
|
+
# decision log (round-2 review finding: decision_log's only other consumer
|
|
216
|
+
# is the Auto-mode JSON reply — without this echo the warning is invisible
|
|
217
|
+
# exactly when a tight alpha tier makes the default run long)
|
|
218
|
+
for entry in result.decision_log:
|
|
219
|
+
if entry.stage == "resample" and "uncapped" in entry.message:
|
|
220
|
+
click.echo(click.style(f" │ warning: {entry.message}", fg="yellow"))
|
|
221
|
+
if not family_sweep and metric_filter is None and len(experiment.comparisons) >= 2:
|
|
222
|
+
# one-release migration notice for the 0.2.0 default flip (m7 WP6)
|
|
223
|
+
click.echo(
|
|
224
|
+
click.style(
|
|
225
|
+
" │ note: the composed family sweep no longer runs by default — "
|
|
226
|
+
"pass --family-sweep to include it (behavior change in 0.2.0)",
|
|
227
|
+
fg="yellow",
|
|
228
|
+
)
|
|
229
|
+
)
|
|
202
230
|
tables.release_lock(experiment.name, "pipeline", "validate", status="completed")
|
|
203
231
|
except BaseException as exc: # incl. KeyboardInterrupt/SystemExit — never strand the lock
|
|
204
232
|
tables.release_lock(
|
|
@@ -197,7 +197,22 @@ def explore(
|
|
|
197
197
|
)
|
|
198
198
|
@click.option("--metric", help="Validate only this metric (default: every declared comparison)")
|
|
199
199
|
@click.option(
|
|
200
|
-
"--iterations",
|
|
200
|
+
"--iterations",
|
|
201
|
+
"-n",
|
|
202
|
+
type=int,
|
|
203
|
+
default=None,
|
|
204
|
+
help=(
|
|
205
|
+
"Placebo A/A splits per cell (default: tied to each cell's effective alpha, "
|
|
206
|
+
"max(2000, ceil(200/alpha)) — e.g. 4000 at the 5% main tier)"
|
|
207
|
+
),
|
|
208
|
+
)
|
|
209
|
+
@click.option(
|
|
210
|
+
"--family-sweep/--no-family-sweep",
|
|
211
|
+
default=False,
|
|
212
|
+
help=(
|
|
213
|
+
"Also run the composed multi-metric FWER/FDR sweep (D9) — roughly doubles the "
|
|
214
|
+
"cost; before 0.2.0 it always ran when --metric was omitted"
|
|
215
|
+
),
|
|
201
216
|
)
|
|
202
217
|
@click.option(
|
|
203
218
|
"--inject-effect",
|
|
@@ -229,7 +244,8 @@ def validate(
|
|
|
229
244
|
select: tuple[str, ...],
|
|
230
245
|
method: tuple[str, ...],
|
|
231
246
|
metric: str | None,
|
|
232
|
-
iterations: int,
|
|
247
|
+
iterations: int | None,
|
|
248
|
+
family_sweep: bool,
|
|
233
249
|
inject_effect: float | None,
|
|
234
250
|
scoring: str,
|
|
235
251
|
report_path: str | None,
|
|
@@ -246,7 +262,16 @@ def validate(
|
|
|
246
262
|
from abkit.cli.commands.validate import run_validate
|
|
247
263
|
|
|
248
264
|
run_validate(
|
|
249
|
-
select,
|
|
265
|
+
select,
|
|
266
|
+
method,
|
|
267
|
+
metric,
|
|
268
|
+
iterations,
|
|
269
|
+
inject_effect,
|
|
270
|
+
scoring,
|
|
271
|
+
report_path,
|
|
272
|
+
force,
|
|
273
|
+
profile,
|
|
274
|
+
family_sweep=family_sweep,
|
|
250
275
|
)
|
|
251
276
|
|
|
252
277
|
|
|
@@ -20,12 +20,13 @@ import hashlib
|
|
|
20
20
|
import itertools
|
|
21
21
|
import math
|
|
22
22
|
from abc import ABC, abstractmethod
|
|
23
|
-
from collections.abc import Sequence
|
|
23
|
+
from collections.abc import Mapping, Sequence
|
|
24
24
|
from dataclasses import dataclass
|
|
25
25
|
from typing import Any, ClassVar
|
|
26
26
|
|
|
27
27
|
import numpy as np
|
|
28
28
|
|
|
29
|
+
from abkit.stats.effects import BatchEffectResult, FloatArray, NormalTest
|
|
29
30
|
from abkit.stats.exceptions import MethodParamError, SampleValidationError
|
|
30
31
|
from abkit.stats.result import TestResult
|
|
31
32
|
from abkit.stats.samples import RatioSample, Sample
|
|
@@ -204,6 +205,69 @@ def require_pair_type(method_name: str, group_1: Any, group_2: Any, expected: ty
|
|
|
204
205
|
)
|
|
205
206
|
|
|
206
207
|
|
|
208
|
+
def suffstats_columns(
|
|
209
|
+
arrays: Mapping[str, FloatArray] | None,
|
|
210
|
+
keys: Sequence[str],
|
|
211
|
+
method_name: str,
|
|
212
|
+
what: str,
|
|
213
|
+
) -> tuple[FloatArray, ...]:
|
|
214
|
+
"""Fetch + float64-cast the suffstats columns a batch kernel needs (M7 WP2).
|
|
215
|
+
|
|
216
|
+
The array mirror of ``require_pair_type``: clear input errors for the
|
|
217
|
+
``from_suffstats_array`` entry — a missing column or ragged shapes raise
|
|
218
|
+
:class:`SampleValidationError` up front, never a downstream numpy error.
|
|
219
|
+
Column VALUES are trusted raw arrays (the vectorized engine builds them);
|
|
220
|
+
per-row degeneracy is the kernels' NaN business, not validation's.
|
|
221
|
+
"""
|
|
222
|
+
if arrays is None:
|
|
223
|
+
raise SampleValidationError(f"{method_name}: {what} is required for from_suffstats_array")
|
|
224
|
+
missing = [key for key in keys if key not in arrays]
|
|
225
|
+
if missing:
|
|
226
|
+
raise SampleValidationError(
|
|
227
|
+
f"{method_name}: {what} is missing suffstats column(s) {missing}; "
|
|
228
|
+
f"required: {list(keys)}"
|
|
229
|
+
)
|
|
230
|
+
columns = tuple(np.asarray(arrays[key], dtype=np.float64) for key in keys)
|
|
231
|
+
for key, column in zip(keys, columns, strict=True):
|
|
232
|
+
if column.ndim != 1:
|
|
233
|
+
raise SampleValidationError(
|
|
234
|
+
f"{method_name}: {what} suffstats column {key!r} must be a 1-D array "
|
|
235
|
+
f"(one row per comparison), got ndim={column.ndim} — wrap scalars in a "
|
|
236
|
+
"length-1 array (adversarial review round 2: 0-d inputs crash or "
|
|
237
|
+
"silently malform the batch result)"
|
|
238
|
+
)
|
|
239
|
+
shapes = {column.shape for column in columns}
|
|
240
|
+
if len(shapes) > 1:
|
|
241
|
+
raise SampleValidationError(
|
|
242
|
+
f"{method_name}: {what} suffstats columns must share one shape, got "
|
|
243
|
+
f"{ {key: np.asarray(arrays[key]).shape for key in keys} }"
|
|
244
|
+
)
|
|
245
|
+
return columns
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def suffstats_pair_columns(
|
|
249
|
+
arrays_1: Mapping[str, FloatArray] | None,
|
|
250
|
+
arrays_2: Mapping[str, FloatArray] | None,
|
|
251
|
+
keys: Sequence[str],
|
|
252
|
+
method_name: str,
|
|
253
|
+
) -> tuple[tuple[FloatArray, ...], tuple[FloatArray, ...]]:
|
|
254
|
+
"""Two-arm :func:`suffstats_columns` with cross-arm row-count validation.
|
|
255
|
+
|
|
256
|
+
Mismatched per-arm batches must fail loudly here (adversarial review
|
|
257
|
+
round 1): without this check numpy would either broadcast a length-1 arm
|
|
258
|
+
silently across the other arm's rows or raise a bare shape ``ValueError``
|
|
259
|
+
deep inside a kernel — both worse than a clear input error.
|
|
260
|
+
"""
|
|
261
|
+
columns_1 = suffstats_columns(arrays_1, keys, method_name, "arrays_1")
|
|
262
|
+
columns_2 = suffstats_columns(arrays_2, keys, method_name, "arrays_2")
|
|
263
|
+
if columns_1[0].shape != columns_2[0].shape:
|
|
264
|
+
raise SampleValidationError(
|
|
265
|
+
f"{method_name}: arrays_1 and arrays_2 must have the same row count, "
|
|
266
|
+
f"got {columns_1[0].shape} vs {columns_2[0].shape}"
|
|
267
|
+
)
|
|
268
|
+
return columns_1, columns_2
|
|
269
|
+
|
|
270
|
+
|
|
207
271
|
def method_config_payload(
|
|
208
272
|
method_name: str,
|
|
209
273
|
identity_params: dict[str, Any],
|
|
@@ -257,6 +321,12 @@ class BaseMethod(ABC):
|
|
|
257
321
|
#: instead of name-checking. Bootstrap percentile CIs are asymmetric → the
|
|
258
322
|
#: bootstrap base sets this False (docs/specs/m5-implementation-plan.md D1).
|
|
259
323
|
supports_sequential: ClassVar[bool] = True
|
|
324
|
+
#: Exposes the M7 WP2 array-wise significance kernel ``from_suffstats_array``
|
|
325
|
+
#: (the validate hot path). Opt-in, mirroring the ``supports_sequential``
|
|
326
|
+
#: precedent: the False default keeps every plugin fully functional through
|
|
327
|
+
#: the scalar ``from_suffstats`` fallback — a method without a batch kernel
|
|
328
|
+
#: is never special-cased, only iterated (m7-implementation-plan.md §WP2).
|
|
329
|
+
supports_vectorized: ClassVar[bool] = False
|
|
260
330
|
|
|
261
331
|
def __init__(self, alpha: float = 0.05, **params: Any) -> None:
|
|
262
332
|
if not 0.0 < alpha < 1.0:
|
|
@@ -343,5 +413,84 @@ class BaseMethod(ABC):
|
|
|
343
413
|
def from_suffstats(self, stats_1: Any, stats_2: Any) -> TestResult:
|
|
344
414
|
"""Compare from sufficient statistics (closed-form pipeline/explore entry)."""
|
|
345
415
|
|
|
416
|
+
def from_suffstats_array(
|
|
417
|
+
self,
|
|
418
|
+
arrays_1: Mapping[str, FloatArray],
|
|
419
|
+
arrays_2: Mapping[str, FloatArray] | None = None,
|
|
420
|
+
) -> BatchEffectResult:
|
|
421
|
+
"""The array-wise significance kernel — one row per comparison (M7 WP2).
|
|
422
|
+
|
|
423
|
+
Optional capability, gated by :attr:`supports_vectorized`: given
|
|
424
|
+
column arrays of per-arm sufficient-statistic components (each
|
|
425
|
+
method's docstring names its keys — the ``SufficientStats``/
|
|
426
|
+
``Fraction``/``RatioSufficientStats`` field names), return a
|
|
427
|
+
:class:`~abkit.stats.effects.BatchEffectResult` computed via numpy
|
|
428
|
+
broadcasting, row-for-row parity with the scalar ``from_suffstats``
|
|
429
|
+
(pinned by ``tests/stats/test_vectorized_parity.py``). Paired methods
|
|
430
|
+
take ONE joint mapping (``arrays_2`` stays None), mirroring their
|
|
431
|
+
scalar signature. Degenerate rows yield NaN, never an exception
|
|
432
|
+
("gaps, never zeros"). Default: not implemented — the validate engine
|
|
433
|
+
must fall back to the scalar loop, never fail the method.
|
|
434
|
+
"""
|
|
435
|
+
raise NotImplementedError(
|
|
436
|
+
f"{self.name}: no array-wise significance kernel "
|
|
437
|
+
"(supports_vectorized=False); use the scalar from_suffstats path"
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
# --- shared result assembly ----------------------------------------------
|
|
441
|
+
def _result_from_normal_test(
|
|
442
|
+
self,
|
|
443
|
+
test: NormalTest,
|
|
444
|
+
*,
|
|
445
|
+
name_1: str | None,
|
|
446
|
+
name_2: str | None,
|
|
447
|
+
value_1: float,
|
|
448
|
+
value_2: float,
|
|
449
|
+
std_1: float,
|
|
450
|
+
std_2: float,
|
|
451
|
+
size_1: int,
|
|
452
|
+
size_2: int,
|
|
453
|
+
cov_value_1: float | None = None,
|
|
454
|
+
cov_value_2: float | None = None,
|
|
455
|
+
mde_1: float | None = None,
|
|
456
|
+
mde_2: float | None = None,
|
|
457
|
+
method_warnings: Sequence[str] = (),
|
|
458
|
+
diagnostics: dict[str, float] | None = None,
|
|
459
|
+
) -> TestResult:
|
|
460
|
+
"""Assemble the shared closed-form ``TestResult`` tail (M7 WP1 A7).
|
|
461
|
+
|
|
462
|
+
The parametric mirror of the bootstrap ``_finalize``: every closed-form
|
|
463
|
+
method ends in the same ~20-kwarg ``TestResult(...)`` differing only in
|
|
464
|
+
the per-arm display fields, so the assembly lives once here (field-drift
|
|
465
|
+
risk, stats-core-review A7). ``method_warnings`` are prepended before the
|
|
466
|
+
test's own warnings — each method's legacy warning order is preserved.
|
|
467
|
+
"""
|
|
468
|
+
return TestResult(
|
|
469
|
+
name_1=name_1,
|
|
470
|
+
name_2=name_2,
|
|
471
|
+
value_1=value_1,
|
|
472
|
+
value_2=value_2,
|
|
473
|
+
std_1=std_1,
|
|
474
|
+
std_2=std_2,
|
|
475
|
+
size_1=size_1,
|
|
476
|
+
size_2=size_2,
|
|
477
|
+
cov_value_1=cov_value_1,
|
|
478
|
+
cov_value_2=cov_value_2,
|
|
479
|
+
mde_1=mde_1,
|
|
480
|
+
mde_2=mde_2,
|
|
481
|
+
method_name=self.name,
|
|
482
|
+
method_params=self.identity_params,
|
|
483
|
+
alpha=self.alpha,
|
|
484
|
+
pvalue=test.pvalue,
|
|
485
|
+
effect=test.effect,
|
|
486
|
+
ci_length=test.ci_length,
|
|
487
|
+
left_bound=test.left_bound,
|
|
488
|
+
right_bound=test.right_bound,
|
|
489
|
+
reject=test.reject,
|
|
490
|
+
effect_distribution=test.distribution,
|
|
491
|
+
warnings=[*method_warnings, *test.warnings],
|
|
492
|
+
diagnostics={} if diagnostics is None else diagnostics,
|
|
493
|
+
)
|
|
494
|
+
|
|
346
495
|
def __repr__(self) -> str:
|
|
347
496
|
return f"{type(self).__name__}(alpha={self.alpha}, params={self.params})"
|
|
@@ -210,6 +210,9 @@ class BaseBootstrapMethod(BaseMethod):
|
|
|
210
210
|
boot_data: FloatArray,
|
|
211
211
|
effect: float,
|
|
212
212
|
result_warnings: list[str],
|
|
213
|
+
*,
|
|
214
|
+
value_1: float | None = None,
|
|
215
|
+
value_2: float | None = None,
|
|
213
216
|
) -> TestResult:
|
|
214
217
|
"""Common bootstrap result computation (baseline §4; H4/H5/H9).
|
|
215
218
|
|
|
@@ -218,6 +221,10 @@ class BaseBootstrapMethod(BaseMethod):
|
|
|
218
221
|
``reject`` False, with an explanatory warning and an ``n_non_finite``
|
|
219
222
|
diagnostic (H5). ``effect_distribution = norm(mean(boot), std(boot))``
|
|
220
223
|
(catalogue parity; omitted when degenerate/non-finite).
|
|
224
|
+
|
|
225
|
+
``value_1``/``value_2`` accept the caller's already-computed per-arm
|
|
226
|
+
point statistics (M7 WP1 A4 — the same ``stat_point`` values feed
|
|
227
|
+
``_point_effect``); when omitted they are computed here.
|
|
221
228
|
"""
|
|
222
229
|
stat = self._stat
|
|
223
230
|
diagnostics: dict[str, float] = {}
|
|
@@ -250,8 +257,8 @@ class BaseBootstrapMethod(BaseMethod):
|
|
|
250
257
|
return TestResult(
|
|
251
258
|
name_1=sample_1.name,
|
|
252
259
|
name_2=sample_2.name,
|
|
253
|
-
value_1=stat_point(sample_1.array, stat),
|
|
254
|
-
value_2=stat_point(sample_2.array, stat),
|
|
260
|
+
value_1=stat_point(sample_1.array, stat) if value_1 is None else value_1,
|
|
261
|
+
value_2=stat_point(sample_2.array, stat) if value_2 is None else value_2,
|
|
255
262
|
std_1=sample_1.std,
|
|
256
263
|
std_2=sample_2.std,
|
|
257
264
|
size_1=sample_1.sample_size,
|
|
@@ -303,9 +310,9 @@ class BootstrapTest(BaseBootstrapMethod):
|
|
|
303
310
|
)
|
|
304
311
|
boot_data = self._boot_effect(boot_1, boot_2)
|
|
305
312
|
result_warnings: list[str] = []
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
313
|
+
value_1 = stat_point(sample_1.array, self._stat)
|
|
314
|
+
value_2 = stat_point(sample_2.array, self._stat)
|
|
315
|
+
effect = self._point_effect(value_1, value_2, result_warnings)
|
|
316
|
+
return self._finalize(
|
|
317
|
+
sample_1, sample_2, boot_data, effect, result_warnings, value_1=value_1, value_2=value_2
|
|
310
318
|
)
|
|
311
|
-
return self._finalize(sample_1, sample_2, boot_data, effect, result_warnings)
|
|
@@ -47,8 +47,16 @@ def percentile_ci(boot_data: FloatArray, alpha: float) -> tuple[float, float]:
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
def pvalue_sign(boot_data: FloatArray) -> float:
|
|
50
|
-
"""Legacy sign-based p-value ``2·min(P(boot>0), P(boot<0))`` (baseline §4, golden parity).
|
|
51
|
-
|
|
50
|
+
"""Legacy sign-based p-value ``2·min(P(boot>0), P(boot<0))`` (baseline §4, golden parity).
|
|
51
|
+
|
|
52
|
+
Counted per side and divided once (M7 WP1 A4) — byte-identical to
|
|
53
|
+
``2·min(np.mean(boot>0), np.mean(boot<0))``: a boolean mean is an exact
|
|
54
|
+
integer count over ``n``, and division by a positive constant is monotone,
|
|
55
|
+
so ``min`` commutes with it.
|
|
56
|
+
"""
|
|
57
|
+
n_positive = int(np.count_nonzero(boot_data > 0.0))
|
|
58
|
+
n_negative = int(np.count_nonzero(boot_data < 0.0))
|
|
59
|
+
return float(2.0 * (min(n_positive, n_negative) / boot_data.size))
|
|
52
60
|
|
|
53
61
|
|
|
54
62
|
def pvalue_plugin(boot_data: FloatArray) -> float:
|
|
@@ -49,9 +49,9 @@ class PairedBootstrapTest(BaseBootstrapMethod):
|
|
|
49
49
|
)
|
|
50
50
|
boot_data = self._boot_effect(boot_1, boot_2)
|
|
51
51
|
result_warnings: list[str] = []
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
value_1 = stat_point(sample_1.array, self._stat)
|
|
53
|
+
value_2 = stat_point(sample_2.array, self._stat)
|
|
54
|
+
effect = self._point_effect(value_1, value_2, result_warnings)
|
|
55
|
+
return self._finalize(
|
|
56
|
+
sample_1, sample_2, boot_data, effect, result_warnings, value_1=value_1, value_2=value_2
|
|
56
57
|
)
|
|
57
|
-
return self._finalize(sample_1, sample_2, boot_data, effect, result_warnings)
|
|
@@ -67,12 +67,12 @@ class PoissonBootstrapTest(BaseBootstrapMethod):
|
|
|
67
67
|
)
|
|
68
68
|
boot_data = self._boot_effect(boot_1, boot_2)
|
|
69
69
|
result_warnings: list[str] = []
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
value_1 = stat_point(sample_1.array, self._stat)
|
|
71
|
+
value_2 = stat_point(sample_2.array, self._stat)
|
|
72
|
+
effect = self._point_effect(value_1, value_2, result_warnings)
|
|
73
|
+
return self._finalize(
|
|
74
|
+
sample_1, sample_2, boot_data, effect, result_warnings, value_1=value_1, value_2=value_2
|
|
74
75
|
)
|
|
75
|
-
return self._finalize(sample_1, sample_2, boot_data, effect, result_warnings)
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
@register
|
|
@@ -104,9 +104,9 @@ class PairedPoissonBootstrapTest(PoissonBootstrapTest):
|
|
|
104
104
|
)
|
|
105
105
|
boot_data = self._boot_effect(boot_1, boot_2)
|
|
106
106
|
result_warnings: list[str] = []
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
value_1 = stat_point(sample_1.array, self._stat)
|
|
108
|
+
value_2 = stat_point(sample_2.array, self._stat)
|
|
109
|
+
effect = self._point_effect(value_1, value_2, result_warnings)
|
|
110
|
+
return self._finalize(
|
|
111
|
+
sample_1, sample_2, boot_data, effect, result_warnings, value_1=value_1, value_2=value_2
|
|
111
112
|
)
|
|
112
|
-
return self._finalize(sample_1, sample_2, boot_data, effect, result_warnings)
|