squlearn.optimizers
.SGLBO
- class squlearn.optimizers.SGLBO(options: dict = None, callback=<function default_callback>)
sQUlearn’s implementation of the SGLBO optimizer
Possible options that can be set in the options dictionary are:
tol (float): Tolerance for the termination of the optimization (default: 1e-6)
maxiter (int): Maximum number of iterations per fit run (default: 100)
maxiter_total (int): Maximum number of iterations in total (default: maxiter)
eps (float): Step size for finite differences (default: 0.01)
num_average (int): Number of gradients to average (default: 1)
bo_n_calls (int): Number of iterations for the Bayesian Optimization (default: 20)
bo_bounds (List): Lower and upper bound for the search space for the Bayesian Optimization for each dimension. Each bound should be provided as a tupel (default: (0.0, 0.3))
bo_n_initial_points (int): Number of initial points for the Bayesian Optimization (default: 10)
bo_acq_func (str): Acquisition function for the Bayesian Optimization (default: “ei”). Valid values are: “ucb”, “ei”, “poi”
bo_xi (float): Exploration-exploitation trade-off parameter for the Bayesian Optimization (default: 0.01)
log_file (str): File to log the optimization (default: None)
- Parameters:
options (dict) – Options for the SGLBO optimizer
- minimize(fun: callable, x0: ndarray, grad: callable = None, bounds=None) OptimizerResult
Function to minimize a given function using the SGLBO optimizer.
- Parameters:
fun (callable) – Function to minimize.
x0 (np.ndarray) – Initial guess.
grad (callable) – Gradient of the function to minimize.
bounds (sequence) – Bounds for the parameters.
- Returns:
OptimizerResult format.
- Return type:
Result of the optimization in class
- reset()
Resets the optimizer to its initial state.
- set_callback(callback)
Set the callback function.
- step(**kwargs)
Perform one update step.
- Parameters:
x – Current value
grad – Precomputed gradient
- Returns:
Updated x