Repository navigation
Description
Task
T-077· Milestone M6 — Analysis + risk · Size S · Priority P1 · Epic #6Implements FR-RSK-004 · FR-RSK-005 · PR-17
Branch
feat/t-077-volumeestimator-sobol-qmc-wilson-cis— one task = one branch = one PR (doc 32 §6)
Summary
Implement risk/volume.py: classify risk.volume_samples Sobol points (respecting pins), report SAFE/UNCERTAIN/FAILURE fractions with 95 % Wilson intervals and robustness_score = 1 − f_FAILURE − 0.5·f_UNCERTAIN.
Context / motivation
Single-number robustness per robot configuration enables MET-07 / EXP-05 (fix-and-prove journey J2).
Scope
In scope
RegionVolumesmodel;robustness_score(vol).
Implementation guidance
- Module
roboprobe/risk/volume.py:class VolumeEstimator: def estimate(self, mapper: RiskMapper, n: int = 8192, seed: int = 0) -> RegionVolumes;def robustness_score(vol: RegionVolumes) -> float(doc 05 §8). - Samples: scrambled Sobol (
scipy.stats.qmc.Sobol(d, scramble=True, seed)) of sizerisk.volume_samples(power of two; validator), mapped onto the unpinned sub-space with pins fixed. RegionVolumes: fractions SAFE/UNCERTAIN/FAILURE each with Wilson 95 % interval (z fromexperiments.alpha→scipy.stats.norm.ppf),n,seed.robustness_score = 1 − f_FAILURE − 0.5·f_UNCERTAIN, which lies in [0, 1] because the fractions sum to 1. Document clearly that the dashboard's −1…1 RobustnessBar shows per-run ρ, not this campaign-level score.- Wilson interval implemented locally (
risk/stats.py), tested againststatsmodels.stats.proportion.proportion_confint(method="wilson")reference values hard-coded in the test (statsmodels not a runtime dependency). - Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff
PLR2004); public APIs typed (mypy strict) and documented.
Configuration keys
From the configuration reference (doc 27). Keys marked (new) must be added to the typed settings models and appear in the generated reference (T-003c).
risk.volume_samplesexperiments.alpha
Acceptance criteria
- Analytic volume match on
multi_mode_6dwithin CI (doc 18 §4.6). - Wilson CI matches reference values.
- Fractions sum to 1 ± 1e-12.
- Seeded estimate reproducible.
- Score within [0, 1] for all inputs (property test).
- Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
- Docs, config reference and CHANGELOG
Unreleasedupdated where behaviour, keys or interfaces changed. - Definition of Done (doc 32 §3) satisfied.
Tests required
tests/unit/risk/test_volume.py.- Analytic
multi_mode_6dvolume test (doc 18 §4.6) using the benchmark's true failure indicator via a stub mapper.
Dependencies
Blocked by: #135 (T-076), #36 (T-023)
Blocks: #137 (T-075a), #152 (T-082b)
Parallelization notes
Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:
backend/src/roboprobe/risk/volume.py
Small.
Definition of Done
Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-077 (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.
References
Design docs: doc 09 §5.4 · doc 05 §8
Requirements: FR-RSK-004 · FR-RSK-005 · PR-17 (traceability: doc 28)
External:
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsBacklog
Activity
report.jsonand analysis artefacts #137/risk,/risk/slice?x=&y=&anchor=&resolution=) #152