Skip to content

[T-077] VolumeEstimator (Sobol QMC), Wilson CIs and robustness score #136

Closed

Description

@CodewithJha

Task T-077 · Milestone M6 — Analysis + risk · Size S · Priority P1 · Epic #6

Implements 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

  • RegionVolumes model; 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 size risk.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 from experiments.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 against statsmodels.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_samples
  • experiments.alpha

Acceptance criteria

  • Analytic volume match on multi_mode_6d within 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 Unreleased updated where behaviour, keys or interfaces changed.
  • Definition of Done (doc 32 §3) satisfied.

Tests required

  • tests/unit/risk/test_volume.py.
  • Analytic multi_mode_6d volume 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

No one assigned

    Labels

    area:riskRisk maps and estimatesmilestone:M6M6 — Analysis + riskpriority:P1Required for milestone exitsize:S<= 1 daytaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions