feat(lotto): calibrate_winner_compute 당첨조합 역분석+percentile

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 17:05:06 +09:00
parent 9f897ea4a0
commit aaba4fbc46
2 changed files with 25 additions and 0 deletions

View File

@@ -68,6 +68,17 @@ def test_point_in_time_excludes_target_draw():
assert len(pit) == 29
def test_calibrate_winner_scores_and_percentile():
draws = _toy_draws(60)
winning6 = [3, 11, 19, 27, 35, 44]
res = bt.calibrate_winner_compute(draws, target_draw_no=60,
winning6=winning6, sample_m=500, seed=9)
assert set(res["scores"].keys()) >= {"score_total", "score_frequency",
"score_fingerprint", "score_gap", "score_cooccur", "score_diversity"}
assert 0.0 <= res["percentile"] <= 1.0
assert res["cache_draws"] == 59 # 1..59
def test_generate_pool_partial_fill(monkeypatch):
"""weighted_sample_6이 항상 같은 조합만 반환하도록 패치 → cap에 먼저 걸려 len < n — 예외 없이 반환."""
import random as _r