Optimization
Optimization Functions
- BOBE.optim.optimize_optax(fun, fun_args=(), fun_kwargs={}, num_params=1, bounds=None, x0=None, optimizer_options={'early_stop_patience': 25, 'lr': 0.001, 'name': 'adam'}, maxiter=200, n_restarts=1, verbose=False)[source]
SEQUENTIAL OPTIMIZER: Minimize a function using JAX + optax, iterating through restarts with a Python for-loop.
Requires optax to be installed. Install with: pip install ‘BOBE[nn]’ or pip install optax
- BOBE.optim.optimize_optax_vmap(fun, fun_args=(), fun_kwargs={}, num_params=1, bounds=None, x0=None, optimizer_options={'early_stop_patience': 25, 'lr': 0.001, 'name': 'adam'}, maxiter=200, n_restarts=1, verbose=False)[source]
VECTORIZED OPTIMIZER: Minimize a function using JAX + optax, vectorizing over restarts with jax.vmap for parallel execution. Only to be used with EI.
Requires optax to be installed. Install with: pip install ‘BOBE[nn]’ or pip install optax
- BOBE.optim.optimize_scipy(fun, fun_args=(), fun_kwargs={}, num_params=1, bounds=None, x0=None, optimizer_options={'ftol': 1e-06, 'gtol': 1e-06, 'method': 'L-BFGS-B'}, maxiter=200, n_restarts=4, verbose=False)[source]
Standalone method to minimize a function using scipy.optimize.minimize.
- Parameters:
fun (
Callable) – The objective function to minimizefun_args (
Optional[Tuple]) – Additional arguments to pass to the functionfun_kwargs (
Optional[dict]) – Additional keyword arguments to pass to the functionnum_params (
int) – Number of parameters.bounds (
Union[List,Tuple,Array,None]) – Parameter bounds in shape (2, num_params).x0 (
Optional[Array]) – Initial guess for the parameters, rescaled to unit space.optimizer_kwargs (Optional[dict]) – Additional keyword arguments to pass to the optimizer.
maxiter (
int) – Maximum number of iterations.n_restarts (
int) – Number of restarts for the optimization.verbose (
bool) – Whether to print progress messages.
- Returns:
The best parameters found and the corresponding function value.
- Return type: