Skip to content

Commit 023214a

Browse files
committed
feat: add novelty bonus to pilot priority formula
Add +0.05×novelty term to _pilot_priority() so that within a seed family, higher-novelty variants are preferred during pilot panel selection. SEED-005 variants (novelty=0.467, the pool maximum) gain up to +0.023 priority — a tiebreaker that pushes the most novel sequence variants into Wave 1 without overriding the ensemble score. Adds three new tests: higher-novelty-higher-priority, missing-novelty- defaults-to-0, and formula contribution verification.
1 parent 1f5ed87 commit 023214a

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

‎src/openamp_foundry/selection/pilot.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ def _seed_from_source(source: str) -> str:
1414

1515

1616
def _pilot_priority(scores: dict) -> float:
17-
"""Higher is better: reward ensemble, reward serum stability, penalise disagreement.
17+
"""Higher is better: reward ensemble, stability, and novelty; penalise disagreement.
1818
19-
Serum stability is weighted lightly (0.05) so it acts as a tiebreaker without
20-
overriding the ensemble score. A candidate with stability=1.0 gains at most +0.05.
19+
Within a seed family, higher-novelty variants are preferred as tiebreakers.
20+
Novelty is weighted lightly (0.05) so the ensemble score remains dominant.
21+
A candidate with novelty=0.467 (SEED-005 max) gains at most +0.023.
2122
"""
2223
ensemble = scores.get("ensemble", 0.0)
2324
disagreement = scores.get("disagreement", 0.5)
2425
stability = scores.get("serum_stability", 0.5)
25-
return round(ensemble - 0.3 * disagreement + 0.05 * stability, 6)
26+
novelty = scores.get("novelty", 0.0)
27+
return round(ensemble - 0.3 * disagreement + 0.05 * stability + 0.05 * novelty, 6)
2628

2729

2830
def select_pilot_panel(

‎tests/test_pilot_panel.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,22 @@ def test_higher_stability_higher_priority(self):
9090
p2 = _pilot_priority({"ensemble": 0.70, "disagreement": 0.10, "serum_stability": 0.0})
9191
assert p1 > p2
9292

93+
def test_higher_novelty_higher_priority(self):
94+
p1 = _pilot_priority({"ensemble": 0.70, "disagreement": 0.10, "novelty": 0.467})
95+
p2 = _pilot_priority({"ensemble": 0.70, "disagreement": 0.10, "novelty": 0.10})
96+
assert p1 > p2
97+
98+
def test_missing_novelty_defaults_to_0(self):
99+
p_absent = _pilot_priority({"ensemble": 0.70, "disagreement": 0.10})
100+
p_zero = _pilot_priority({"ensemble": 0.70, "disagreement": 0.10, "novelty": 0.0})
101+
assert p_absent == pytest.approx(p_zero, abs=1e-9)
102+
103+
def test_novelty_formula_contribution(self):
104+
# novelty bonus = 0.05 * 0.40 = 0.02; stability absent → 0.5
105+
p = _pilot_priority({"ensemble": 0.70, "disagreement": 0.10, "novelty": 0.40})
106+
expected = 0.70 - 0.3 * 0.10 + 0.05 * 0.5 + 0.05 * 0.40
107+
assert p == pytest.approx(expected, abs=1e-6)
108+
93109

94110
class TestSelectPilotPanel:
95111
def test_empty_input_returns_empty(self):

0 commit comments

Comments
 (0)