anhtld commited on
Commit
c0170b2
·
verified ·
1 Parent(s): 3bb00d1

auto-sync 2026-07-04T07:48:09Z workspace (part 5)

Browse files
workspace/tests/test_dominance_selector.py CHANGED
@@ -13,6 +13,7 @@ from scripts.eval_dominance_selector import (
13
  _pairwise_calibration_summary as _score_pairwise_calibration_summary,
14
  )
15
  from scripts.eval_learned_dominance_selector import (
 
16
  _chart_compat_feature,
17
  _candidate_feature,
18
  _choose_thresholds,
@@ -502,6 +503,45 @@ def test_score_shape_feature_set_and_markdown_suppression(tmp_path) -> None:
502
  assert report_path.exists()
503
 
504
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  def test_chart_compat_feature_is_deployment_visible_and_fixed_width() -> None:
506
  base = np.arange(14, dtype=float).reshape(2, 7) / 10.0
507
  context = np.linspace(-0.5, 0.5, 18)
 
13
  _pairwise_calibration_summary as _score_pairwise_calibration_summary,
14
  )
15
  from scripts.eval_learned_dominance_selector import (
16
+ _bundle_consensus_matrix,
17
  _chart_compat_feature,
18
  _candidate_feature,
19
  _choose_thresholds,
 
503
  assert report_path.exists()
504
 
505
 
506
+ def test_bundle_consensus_features_are_deployment_visible_and_fixed_width() -> None:
507
+ tangents = [
508
+ np.zeros(21, dtype=float),
509
+ np.full(21, 0.10, dtype=float),
510
+ np.full(21, 1.00, dtype=float),
511
+ ]
512
+ scores = [3.0, 2.0, -1.0]
513
+ bundle = _bundle_consensus_matrix(
514
+ tangents,
515
+ scores,
516
+ ["source_a", "source_b", "source_a"],
517
+ ["pick", "pick", "stack"],
518
+ )
519
+ feature = _candidate_feature(
520
+ score=3.0,
521
+ base_score=0.25,
522
+ score_mean=1.0,
523
+ score_std=2.0,
524
+ candidate_index=0,
525
+ candidate_type="ctt_transport_rank0",
526
+ tangent=tangents[0],
527
+ num_candidates=3,
528
+ feature_set="score_chart_bundle_consensus",
529
+ chart_compat=np.ones(22, dtype=float),
530
+ score_shape=_score_shape_matrix(scores)[0],
531
+ bundle_consensus=bundle[0],
532
+ )
533
+
534
+ assert bundle.shape == (3, 19)
535
+ assert bundle[0, 1] == 1.0
536
+ assert bundle[0, 2] == 1.0
537
+ assert bundle[0, 3] == pytest.approx(0.5)
538
+ assert bundle[0, 13] == 2.0
539
+ assert bundle[0, 15] == 1.0
540
+ assert np.all(np.isfinite(bundle))
541
+ assert len(feature) == len(_feature_names("score_chart_bundle_consensus"))
542
+ assert len(feature) == 10 + 8 + 22 + 19
543
+
544
+
545
  def test_chart_compat_feature_is_deployment_visible_and_fixed_width() -> None:
546
  base = np.arange(14, dtype=float).reshape(2, 7) / 10.0
547
  context = np.linspace(-0.5, 0.5, 18)