fix(lotto): 학습 게이트 정직화 (engine-best vs random-best 6trial·명시적 gated·정체성 일관)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 17:47:52 +09:00
parent 03056a4747
commit 4063f29cd3
4 changed files with 221 additions and 14 deletions

View File

@@ -6,6 +6,9 @@ from typing import Any, Dict, List, Optional, Tuple
from .analyzer import build_analysis_cache, build_number_weights, score_combination
from .utils import weighted_sample_6
# engine_w trials 수와 동일하게 맞춰 selection bias를 상쇄한다.
N_NULL_TRIALS = 6
def grade_tickets(tickets: List[List[int]], winning6: List[int], bonus: int) -> Dict[str, Any]:
"""티켓 묶음을 당첨번호로 채점 → 매칭 히스토그램 + 보너스 + best_match.
@@ -194,8 +197,10 @@ def run_forward_purchase(draw_no: int, k: int = 5000, pool_n: int = 20000,
bought = purchase_tickets(pool, cache, base, k)
_store("engine_w", "base", base, None, bought)
# 2) random_null
_store("random_null", "-", None, None, random_null_tickets(k, seed=sample_seed))
# 2) random_null — N_NULL_TRIALS 개 (engine_w 수와 동일해 selection bias 상쇄)
for _i in range(N_NULL_TRIALS):
seed_i = None if sample_seed is None else sample_seed + 100 + _i
_store("random_null", f"r{_i}", None, None, random_null_tickets(k, seed=seed_i))
# 3) coverage
_store("coverage", "-", None, None, coverage_tickets(k, seed=sample_seed))