- final_BallFilter: CSV history loader, TRAIN_ALLOW for 6-sum and week diff, fix filterOneDigitPattern ball overwrite bug, drop socket call - final_filter_params: build sum6 and abs_sum_diff from rounds 1-800 - filter_model re-exports BallFilter; train/valid evaluate pass-through counts - final_filterTest aligned with 1_FilterTest_25 plus optional MC survivors - README and scripts/run_with_ncue.sh for ncue workflow Made-with: Cursor
51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
"""
|
|
학습 구간(1~800회): 당첨번호가 필터를 모두 통과한 회차 수를 집계합니다.
|
|
최소 20회차 이후부터 통계(최근 N주 등)가 의미 있으므로 기본은 21~800회만 평가합니다.
|
|
"""
|
|
|
|
import argparse
|
|
import os
|
|
|
|
import pandas as pd
|
|
|
|
from final_BallFilter import BallFilter
|
|
|
|
|
|
def load_history(resources_path: str) -> pd.DataFrame:
|
|
path = os.path.join(resources_path, "lotto_history.txt")
|
|
df = pd.read_csv(path, header=None)
|
|
df.columns = ["no", "b1", "b2", "b3", "b4", "b5", "b6", "bn"]
|
|
return df
|
|
|
|
|
|
def run_train(resources_path: str, start_no: int, end_no: int) -> tuple[int, int, list[int]]:
|
|
df = load_history(resources_path)
|
|
hist_path = os.path.join(resources_path, "lotto_history.txt")
|
|
bf = BallFilter(hist_path)
|
|
wins = 0
|
|
total = 0
|
|
win_nos: list[int] = []
|
|
for no in range(start_no, end_no + 1):
|
|
sub = df[df["no"] == no]
|
|
if sub.empty:
|
|
continue
|
|
answer = sorted(int(x) for x in sub.iloc[0][1:7].tolist())
|
|
fts = bf.extract_final_candidates(answer, no=no, until_end=True, df=df)
|
|
total += 1
|
|
if len(fts) == 0:
|
|
wins += 1
|
|
win_nos.append(no)
|
|
return wins, total, win_nos
|
|
|
|
|
|
if __name__ == "__main__":
|
|
p = argparse.ArgumentParser()
|
|
p.add_argument("--resources", default=os.path.join(os.path.dirname(__file__), "resources"))
|
|
p.add_argument("--start-no", type=int, default=21)
|
|
p.add_argument("--end-no", type=int, default=800)
|
|
args = p.parse_args()
|
|
w, t, nos = run_train(args.resources, args.start_no, args.end_no)
|
|
rate = w / t if t else 0.0
|
|
print(f"학습 구간 당첨 통과: {w} / {t} ({rate:.4f})")
|
|
print(f"통과 회차: {nos}")
|