옵투나 오류수정정

This commit is contained in:
Your Name
2026-08-21 20:18:24 +09:00
parent 0780b2cdd0
commit 3eaa3b61df
14 changed files with 370 additions and 106 deletions

View File

@@ -354,8 +354,14 @@ def run_breakout_optuna(
direction="maximize",
sampler=_make_sampler(sampler_name, seed),
)
from kis_trader.backtest.optuna_study_store import bind_study_trials, finalize_optuna_export
from kis_trader.backtest.optuna_study_store import (
bind_study_trials,
clamp_optimize_n_trials,
finalize_optuna_export,
make_study_goal_stop_callback,
)
bind_study_trials(study, n_trials=n_trials, log=logger)
n_trials = clamp_optimize_n_trials(study, n_trials, log=logger)
def objective(trial: optuna.Trial) -> float:
if ctx.mode == "tpe":
@@ -400,7 +406,16 @@ def run_breakout_optuna(
logger.info("🔬 Optuna BREAKOUT | study=%s | trials=%d", study_name, n_trials)
t0 = time.time()
try:
study.optimize(objective, n_trials=n_trials, n_jobs=n_jobs, show_progress_bar=show_progress)
if n_trials <= 0:
logger.info("📌 추가 trial 없음 — 기존 study 결과만 정리")
else:
study.optimize(
objective,
n_trials=n_trials,
n_jobs=n_jobs,
show_progress_bar=show_progress,
callbacks=[make_study_goal_stop_callback(logger)],
)
elapsed = time.time() - t0
passing: List[Dict[str, Any]] = []