Skip to content

[T-100b] Metrics: MET-02 (unique modes vs reference/pooled clustering), MET-04 (coverage), MET-08 (boundary accuracy), MET-09 (discovery AUC) #105

Closed

Description

@CodewithJha

Task T-100b · Milestone M4 — Baselines + metrics + experiments · Size M · Priority P0 · Epic #4

Implements FR-EXP-001 · FR-EXP-003

Branch feat/t-100b-metrics-met-02-unique-modes — one task = one branch = one PR (doc 32 §6)

Summary

Implement reference-based and coverage metrics in metrics/discovery_metrics.py per doc 19 §3: GT-labelled mode recall via nearest failing reference point within radius r (k2d), pooled clustering variant (Gazebo), 2-way bin coverage C2 and failure-region coverage CF, balanced accuracy/recall/F1 of p_fail > 0.5, discovery-curve AUC.

Context / motivation

These are the metrics behind H2–H4 and SC-2/SC-3.

Scope

In scope

  • KD-tree nearest neighbour (scipy.spatial.cKDTree).
  • Discovery curve modes(n) series reused by dashboard/report.

Implementation guidance

  • Pooled clustering function accepts failures from all strategies for the same seed index and returns per-strategy hit counts.
  • 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).

  • experiments.mode_match_radius
  • experiments.coverage_bins

Acceptance criteria

  • Hand-computed toy examples for each metric.
  • Discovery curve monotone non-decreasing.
  • 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/metrics/test_discovery_metrics.py.

Dependencies

Blocked by: #61 (T-011a), #36 (T-023)

Blocks: #109 (T-102b)

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/metrics/discovery_metrics.py

Parallel with T-100a.

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-100b (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 19 §3 · doc 19 §5 · doc 09 §5.5

Requirements: FR-EXP-001 · FR-EXP-003 (traceability: doc 28)

External:

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:metricsEvaluation metrics MET-xxmilestone:M4M4 — Baselines + metrics + experimentspriority:P0Critical path / blocks otherssize:M1-3 daystaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions