Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 74 additions & 74 deletions bayes_opt/acquisition.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bayes_opt/bayesian_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def maximize(self, init_points=5, n_iter=25):

Parameters
----------
init_points : int, optional(default=5)
init_points: int, optional(default=5)
Number of iterations before the explorations starts the exploration
for the maximum.

Expand Down Expand Up @@ -335,7 +335,7 @@ def set_bounds(self, new_bounds):

Parameters
----------
new_bounds : dict
new_bounds: dict
A dictionary with the parameter name and its new bounds
"""
self._space.set_bounds(new_bounds)
Expand Down
16 changes: 8 additions & 8 deletions bayes_opt/constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ class ConstraintModel:

Parameters
----------
fun : None or Callable -> float or np.ndarray
fun: None or Callable -> float or np.ndarray
The constraint function. Should be float-valued or array-valued (if
multiple constraints are present). Needs to take the same parameters
as the optimization target with the same argument names.

lb : float or np.ndarray
lb: float or np.ndarray
The lower bound on the constraints. Should have the same
dimensionality as the return value of the constraint function.

ub : float or np.ndarray
ub: float or np.ndarray
The upper bound on the constraints. Should have the same
dimensionality as the return value of the constraint function.

random_state : np.random.RandomState or int or None, default=None
random_state: np.random.RandomState or int or None, default=None
Random state to use.

Notes
Expand Down Expand Up @@ -82,7 +82,7 @@ def eval(self, **kwargs: dict): # noqa: D417

Parameters
----------
\*\*kwargs : any
\*\*kwargs: any
Function arguments to evaluate the constraint function on.


Expand Down Expand Up @@ -152,7 +152,7 @@ def predict(self, X):

Parameters
----------
X : np.ndarray of shape (n_samples, n_features)
X: np.ndarray of shape (n_samples, n_features)
Parameters for which to predict the probability of constraint
fulfilment.

Expand Down Expand Up @@ -195,7 +195,7 @@ def approx(self, X):

Parameters
----------
X : np.ndarray of shape (n_samples, n_features)
X: np.ndarray of shape (n_samples, n_features)
Parameters for which to estimate the constraint function value.

Returns
Expand All @@ -216,7 +216,7 @@ def allowed(self, constraint_values):

Parameters
----------
constraint_values : np.ndarray of shape (n_samples, n_constraints)
constraint_values: np.ndarray of shape (n_samples, n_constraints)
The values of the constraint function.


Expand Down
26 changes: 13 additions & 13 deletions bayes_opt/domain_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ class SequentialDomainReductionTransformer(DomainTransformer):

Parameters
----------
gamma_osc : float, default=0.7
gamma_osc: float, default=0.7
Parameter used to scale (typically dampen) oscillations.

gamma_pan : float, default=1.0
gamma_pan: float, default=1.0
Parameter used to scale (typically unitary) panning.

eta : float, default=0.9
eta: float, default=0.9
Zooming parameter used to shrink the region of interest.

minimum_window : float or np.ndarray or dict, default=0.0
minimum_window: float or np.ndarray or dict, default=0.0
Minimum window size for each parameter. If a float is provided,
the same value is used for all parameters.
"""
Expand All @@ -75,7 +75,7 @@ def initialize(self, target_space: TargetSpace) -> None:

Parameters
----------
target_space : TargetSpace
target_space: TargetSpace
TargetSpace this DomainTransformer operates on.
"""
# Set the original bounds
Expand Down Expand Up @@ -117,7 +117,7 @@ def _update(self, target_space: TargetSpace) -> None:

Parameters
----------
target_space : TargetSpace
target_space: TargetSpace
TargetSpace this DomainTransformer operates on.
"""
# setting the previous
Expand All @@ -144,15 +144,15 @@ def _trim(self, new_bounds: np.ndarray, global_bounds: np.ndarray) -> np.ndarray

Parameters
----------
new_bounds : np.ndarray
new_bounds: np.ndarray
The proposed new_bounds that (may) need adjustment.

global_bounds : np.ndarray
global_bounds: np.ndarray
The maximum allowable bounds for each parameter.

Returns
-------
new_bounds : np.ndarray
new_bounds: np.ndarray
The adjusted bounds after enforcing constraints.
"""
# sort bounds
Expand Down Expand Up @@ -227,7 +227,7 @@ def _window_bounds_compatibility(self, global_bounds: np.ndarray):

Parameters
----------
global_bounds : np.ndarray
global_bounds: np.ndarray
The maximum allowable bounds for each parameter.

Raises
Expand All @@ -246,10 +246,10 @@ def _create_bounds(self, parameters: dict, bounds: np.ndarray) -> dict:

Parameters
----------
parameters : dict
parameters: dict
The parameters for which to create the bounds.

bounds : np.ndarray
bounds: np.ndarray
The bounds for each parameter.
"""
return {param: bounds[i, :] for i, param in enumerate(parameters)}
Expand All @@ -259,7 +259,7 @@ def transform(self, target_space: TargetSpace) -> dict:

Parameters
----------
target_space : TargetSpace
target_space: TargetSpace
TargetSpace this DomainTransformer operates on.

Returns
Expand Down
34 changes: 17 additions & 17 deletions bayes_opt/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def _get_default_logger(verbose, is_constrained):

Parameters
----------
verbose : int
verbose: int
Verbosity level of the logger.

is_constrained : bool
is_constrained: bool
Whether the underlying optimizer uses constraints (this requires
an additional column in the output).

Expand All @@ -42,10 +42,10 @@ class ScreenLogger(_Tracker):

Parameters
----------
verbose : int
verbose: int
Verbosity level of the logger.

is_constrained : bool
is_constrained: bool
Whether the logger is associated with a constrained optimization
instance.
"""
Expand Down Expand Up @@ -73,7 +73,7 @@ def verbose(self, v):

Parameters
----------
v : int
v: int
New verbosity level of the logger.
"""
self._verbose = v
Expand All @@ -88,7 +88,7 @@ def _format_number(self, x):

Parameters
----------
x : number
x: number
Value to format.

Returns
Expand All @@ -111,7 +111,7 @@ def _format_bool(self, x):

Parameters
----------
x : boolean
x: boolean
Value to format.

Returns
Expand All @@ -126,7 +126,7 @@ def _format_key(self, key):

Parameters
----------
key : string
key: string
Value to format.

Returns
Expand All @@ -143,7 +143,7 @@ def _step(self, instance, colour=_colour_regular_message):

Parameters
----------
instance : bayesian_optimization.BayesianOptimization
instance: bayesian_optimization.BayesianOptimization
The instance associated with the event.

colour :
Expand All @@ -170,7 +170,7 @@ def _header(self, instance):

Parameters
----------
instance : bayesian_optimization.BayesianOptimization
instance: bayesian_optimization.BayesianOptimization
The instance associated with the header.

Returns
Expand All @@ -195,7 +195,7 @@ def _is_new_max(self, instance):

Parameters
----------
instance : bayesian_optimization.BayesianOptimization
instance: bayesian_optimization.BayesianOptimization
The instance associated with the step.

Returns
Expand All @@ -216,11 +216,11 @@ def update(self, event, instance):

Parameters
----------
event : str
event: str
One of the values associated with `Events.OPTIMIZATION_START`,
`Events.OPTIMIZATION_STEP` or `Events.OPTIMIZATION_END`.

instance : bayesian_optimization.BayesianOptimization
instance: bayesian_optimization.BayesianOptimization
The instance associated with the step.
"""
if event == Events.OPTIMIZATION_START:
Expand Down Expand Up @@ -248,10 +248,10 @@ class JSONLogger(_Tracker):

Parameters
----------
path : str or bytes or os.PathLike
path: str or bytes or os.PathLike
Path to the file to write to.

reset : bool
reset: bool
Whether to overwrite the file if it already exists.

"""
Expand All @@ -269,11 +269,11 @@ def update(self, event, instance):

Parameters
----------
event : str
event: str
One of the values associated with `Events.OPTIMIZATION_START`,
`Events.OPTIMIZATION_STEP` or `Events.OPTIMIZATION_END`.

instance : bayesian_optimization.BayesianOptimization
instance: bayesian_optimization.BayesianOptimization
The instance associated with the step.

"""
Expand Down
4 changes: 2 additions & 2 deletions bayes_opt/observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def _update_tracker(self, event, instance):

Parameters
----------
event : str
event: str
One of the values associated with `Events.OPTIMIZATION_START`,
`Events.OPTIMIZATION_STEP` or `Events.OPTIMIZATION_END`.

instance : bayesian_optimization.BayesianOptimization
instance: bayesian_optimization.BayesianOptimization
The instance associated with the step.
"""
if event == Events.OPTIMIZATION_STEP:
Expand Down
22 changes: 11 additions & 11 deletions bayes_opt/target_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ class TargetSpace:

Parameters
----------
target_func : function
target_func: function
Function to be maximized.

pbounds : dict
pbounds: dict
Dictionary with parameters names as keys and a tuple with minimum
and maximum values.

random_state : int, RandomState, or None
random_state: int, RandomState, or None
optionally specify a seed for a random number generator

allow_duplicate_points: bool, optional (default=False)
Expand Down Expand Up @@ -219,7 +219,7 @@ def params_to_array(self, params):

Parameters
----------
params : dict
params: dict
a single point, with len(x) == self.dim.

Returns
Expand All @@ -240,7 +240,7 @@ def array_to_params(self, x):

Parameters
----------
x : np.ndarray
x: np.ndarray
a single point, with len(x) == self.dim.

Returns
Expand Down Expand Up @@ -276,13 +276,13 @@ def register(self, params, target, constraint_value=None):

Parameters
----------
params : np.ndarray
params: np.ndarray
a single point, with len(x) == self.dim.

target : float
target: float
target function value

constraint_value : float or None
constraint_value: float or None
Constraint function value

Raises
Expand Down Expand Up @@ -363,12 +363,12 @@ def probe(self, params):

Parameters
----------
params : np.ndarray
params: np.ndarray
a single point, with len(x) == self.dim

Returns
-------
result : float | Tuple(float, float)
result: float | Tuple(float, float)
target function value, or Tuple(target function value, constraint value)

Example
Expand Down Expand Up @@ -504,7 +504,7 @@ def set_bounds(self, new_bounds):

Parameters
----------
new_bounds : dict
new_bounds: dict
A dictionary with the parameter name and its new bounds
"""
for row, key in enumerate(self.keys):
Expand Down
Loading