From 2d72246dce8b245c0c76e4807337affd3f893a65 Mon Sep 17 00:00:00 2001 From: Elizabeth Santorella Date: Wed, 26 Jul 2023 15:20:18 -0400 Subject: [PATCH] remove print statements --- botorch/optim/core.py | 6 +----- botorch/optim/utils/timeout.py | 1 - test/optim/test_core.py | 2 -- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/botorch/optim/core.py b/botorch/optim/core.py index 64c4612dae..97afdb59f1 100644 --- a/botorch/optim/core.py +++ b/botorch/optim/core.py @@ -98,11 +98,9 @@ def scipy_minimize( call_counter = count(1) # callbacks are typically made at the end of each iter def wrapped_callback(x: ndarray): - fval = float(wrapped_closure(x)[0]) - print(f"{fval=}") result = OptimizationResult( step=next(call_counter), - fval=fval, + fval=float(wrapped_closure(x)[0]), status=OptimizationStatus.RUNNING, runtime=monotonic() - start_time, ) @@ -118,8 +116,6 @@ def wrapped_callback(x: ndarray): callback=wrapped_callback, timeout_sec=timeout_sec, ) - print(f"{raw=}") - print(f"{raw.message=}") # Post-processing and outcome handling wrapped_closure.state = asarray(raw.x) # set parameter state to optimal values diff --git a/botorch/optim/utils/timeout.py b/botorch/optim/utils/timeout.py index faffcbba83..474d0d52c4 100644 --- a/botorch/optim/utils/timeout.py +++ b/botorch/optim/utils/timeout.py @@ -46,7 +46,6 @@ def minimize_with_timeout( def timeout_callback(xk: np.ndarray) -> bool: runtime = time.monotonic() - start_time - print(f"{runtime=}") callback_data["num_iterations"] += 1 if runtime > timeout_sec: raise OptimizationTimeoutError(current_x=xk, runtime=runtime) diff --git a/test/optim/test_core.py b/test/optim/test_core.py index d4c13b7f18..2dcdfa5b61 100644 --- a/test/optim/test_core.py +++ b/test/optim/test_core.py @@ -83,8 +83,6 @@ def test_timeout(self): # adding a small delay here to combat some timing issues on windows closure = partial(norm_squared, x, delay=1e-2) result = scipy_minimize(closure, {"x": x}, timeout_sec=1e-4) - print(f"{result=}") - print(f"{result.message=}") self.assertEqual(result.status, OptimizationStatus.STOPPED) self.assertTrue("Optimization timed out after" in result.message)