Skip to content

Commit f2e1c70

Browse files
ltiaometa-codesync[bot]
authored andcommitted
Use debug logging for early stopping decisions that get filtered downstream (facebook#4652)
Summary: Pull Request resolved: facebook#4652 The early stopping strategy was logging at info level for routine decisions, cluttering logs during optimization runs. Additionally, when `should_early_stop` returns False, the trial index and reason messages are filtered out downstream, so these messages were never being surfaced anyway. Changed logging to debug level to reduce noise while still preserving the information for debugging when needed. Reviewed By: saitcakmak Differential Revision: D88914755 fbshipit-source-id: 47b0dd88e6408eeecfb1770f8541ce4047bf6195
1 parent 7cf33bd commit f2e1c70

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

ax/early_stopping/strategies/percentile.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def _should_stop_trial_early(
295295
if self.min_curves is not None:
296296
is_insufficient = window_num_active_trials < self.min_curves
297297
if is_insufficient.any():
298-
return False, (
298+
reason = (
299299
f"Insufficiently many trials with data at progressions in window "
300300
f"[{window_start:.2f}, {window_end:.2f}]\n"
301301
f"- Progressions: {window_values[is_insufficient].index.tolist()}\n"
@@ -305,6 +305,8 @@ def _should_stop_trial_early(
305305
f"{window_active_trial_indices[is_insufficient].tolist()}\n"
306306
f"- Minimum required: {self.min_curves}"
307307
)
308+
logger.debug(reason)
309+
return False, reason
308310

309311
# Check if trial is in top n_best_trials_to_complete
310312
# and should be protected from early stopping
@@ -329,7 +331,7 @@ def _should_stop_trial_early(
329331
f"- Progressions: {window_values.index.tolist()}\n"
330332
f"- Best trials: {window_best_trials.tolist()}"
331333
)
332-
logger.info(reason)
334+
logger.debug(reason)
333335
return False, reason
334336

335337
# Calculate the percentile threshold for each progression.
@@ -363,8 +365,6 @@ def _should_stop_trial_early(
363365
f"- Number of trials: {window_num_active_trials.tolist()}\n"
364366
f"- Trial indices: {window_active_trial_indices.tolist()}"
365367
)
366-
367-
if should_early_stop:
368-
logger.info(f"Early stopping trial {trial_index}: {reason}.")
368+
logger.debug(f"Early stopping trial {trial_index}: {reason}.")
369369

370370
return should_early_stop, reason

0 commit comments

Comments
 (0)