Repository navigation
Description
Task
T-056b· Milestone M5 — Intelligent selection · Size S · Priority P0 · Epic #5Implements FR-SEL-003
Branch
feat/t-056b-diversity-penalty-over-known-failure— one task = one branch = one PR (doc 32 §6)
Summary
Implement penalty(x) = Π_k (1 − exp(−½ Σ_j ((x_j − m_kj)/r_j)²)) with r_j = κ·ℓ_j and α_falsify = log EV + λ·log(penalty + 1e−12) (doc 07 §5.3), plus a mode cache refreshed every mode_cache_refresh_every observations by a cheap HDBSCAN on failing points.
Context / motivation
Pushes the budget towards new failure modes instead of 50 copies of one (MET-02).
Scope
In scope
selection/diversity.py:ModeCache,DiversityPenalizedEVacquisition.
Implementation guidance
- Cheap clustering may reuse sklearn HDBSCAN with small
min_cluster_size; do not depend on the analysis package (layering: selection must not import analysis — implement locally). - 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).
selection.probe.lambda_divselection.probe.kappa_radiusselection.mode_cache_refresh_every
Acceptance criteria
- Penalty → 0 at medoids, → 1 far away (tests).
- Cache refresh cadence honoured.
- 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/selection/test_diversity.py.
Dependencies
Blocked by: #112 (T-056a)
Blocks: #119 (T-059c)
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/selection/diversity.py
Parallel with T-056c.
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-056b (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 07 §5.3 · doc 07 §6.3
Requirements: FR-SEL-003 (traceability: doc 28)
External:
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsBacklog
Activity