feat(lotto): calibrate_winner_compute 당첨조합 역분석+percentile
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -91,6 +91,20 @@ def point_in_time_draws(draws: List[Tuple[int, List[int]]],
|
||||
return [(d, nums) for d, nums in draws if d < target_draw_no]
|
||||
|
||||
|
||||
def calibrate_winner_compute(draws, target_draw_no, winning6,
|
||||
sample_m: int = 2000, seed: Optional[int] = None) -> Dict[str, Any]:
|
||||
"""순수 연산: point-in-time 캐시로 당첨조합 채점 + 무작위 M표본 percentile."""
|
||||
pit = point_in_time_draws(draws, target_draw_no)
|
||||
cache = build_analysis_cache(pit)
|
||||
scores = score_combination(sorted(winning6), cache)
|
||||
win_total = scores["score_total"]
|
||||
samples = random_null_tickets(sample_m, seed=seed)
|
||||
le = sum(1 for t in samples
|
||||
if score_combination(t, cache)["score_total"] <= win_total)
|
||||
percentile = le / max(len(samples), 1)
|
||||
return {"scores": scores, "percentile": percentile, "cache_draws": len(pit)}
|
||||
|
||||
|
||||
def coverage_tickets(k: int, seed: Optional[int] = None) -> List[List[int]]:
|
||||
"""greedy 커버리지 — 아직 덜 쓰인 번호를 우선 배치해 번호를 넓게 분산.
|
||||
(휠링/보장설계는 향후. 현재는 distinct + 번호 사용 균등화)"""
|
||||
|
||||
Reference in New Issue
Block a user