옵투나 오류수정정
This commit is contained in:
@@ -431,8 +431,14 @@ def run_momentum_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":
|
||||
@@ -485,7 +491,16 @@ def run_momentum_optuna(
|
||||
)
|
||||
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]] = []
|
||||
|
||||
Reference in New Issue
Block a user