mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-12-05 18:44:41 +01:00
Add optimization study O06: does a staged evaluation ladder (cheap diagnostics, a development battery, then full evaluation) save total cost without rejecting useful candidates? - Arms: full evaluation of every candidate (bounded reference), a development-only ladder, and a ladder with a stage-0 score; usefulness is decided only by full evaluation with every collateral endpoint. - Stage-0 scores must earn their role: predictor quality (Spearman, AUC) is reported, and separability or KL never substitutes for task success. - Extra development samples use an anytime-valid mixture test (or a single fixed-sample look); naive repeated peeking is refused. Null simulations: 0.0245 and 0.0405 at alpha 0.05 against 0.24 for peeking. - A seeded audit sample of exclusions is fully evaluated and every exclusion is reported. Rules are digest-bound; confirmation-exposed, test and confirmation rows are refused. - Verdict is "no improvement" unless every seed passes cost, false-rejection, task and collateral tolerances with an unchanged confirmation candidate. `obliteratus experiments screening`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
2.9 KiB
Python
53 lines
2.9 KiB
Python
"""``obliteratus experiments screening run|simulate-null``: the O06 calibrated screening study."""
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
|
|
def add_screening(commands):
|
|
parser = commands.add_parser(
|
|
"screening", help="O06 study: staged evaluation ladder against full evaluation")
|
|
sub = parser.add_subparsers(dest="screening_command", required=True)
|
|
run = sub.add_parser("run", help="Run the study on recorded per-row candidate outcomes")
|
|
run.add_argument("--spec", required=True, help="Screening study spec JSON (stage rules)")
|
|
run.add_argument("--outcomes", required=True,
|
|
help="Per-candidate per-row outcomes JSON (screening-outcomes/1)")
|
|
run.add_argument("--out", required=True, help="Output directory for screening.json")
|
|
run.add_argument("--registry", action="append", default=[],
|
|
help="Run or registry directory whose exposed confirmation rows are "
|
|
"refused (repeatable)")
|
|
run.add_argument("--expect-spec-sha256",
|
|
help="Refuse unless the resolved spec has this digest")
|
|
null = sub.add_parser("simulate-null",
|
|
help="Null rejection rate of a stage-1 procedure (calibration check)")
|
|
null.add_argument("--method", default="mixture-martingale",
|
|
choices=("mixture-martingale", "fixed-sample", "naive-peeking"))
|
|
null.add_argument("--p0", type=float, default=0.5)
|
|
null.add_argument("--alpha", type=float, default=0.05)
|
|
null.add_argument("--batch", type=int, default=4)
|
|
null.add_argument("--max-rows", type=int, default=120)
|
|
null.add_argument("--repetitions", type=int, default=2000)
|
|
null.add_argument("--seed", type=int, default=0)
|
|
|
|
|
|
def run_screening_command(args):
|
|
if args.screening_command == "simulate-null":
|
|
from obliteratus.analysis.screening_sequential import simulate_null
|
|
return simulate_null(args.method, p0=args.p0, alpha=args.alpha, batch=args.batch,
|
|
max_rows=args.max_rows, repetitions=args.repetitions,
|
|
seed=args.seed)
|
|
from obliteratus.analysis.screening_report import run_screening_study, write_report
|
|
from obliteratus.analysis.screening_spec import TableEvaluator
|
|
spec = json.loads(Path(args.spec).read_text())
|
|
outcomes = json.loads(Path(args.outcomes).read_text())
|
|
report = run_screening_study(spec, TableEvaluator(outcomes),
|
|
registry_dirs=[Path(r) for r in args.registry],
|
|
expected_spec_sha256=args.expect_spec_sha256)
|
|
path = write_report(report, args.out)
|
|
return {"report": str(path), "report_sha256": report["report_sha256"],
|
|
"spec_sha256": report["spec_sha256"], "recommendation": report["recommendation"],
|
|
"verdicts": {name: arm["verdict"]["verdict"] for name, arm in report["arms"].items()}}
|
|
|
|
|
|
__all__ = ["add_screening", "run_screening_command"]
|