1212from os import PathLike
1313from pathlib import Path
1414from typing import TYPE_CHECKING , Any
15- from warnings import warn
1615
1716import numpy as np
1817from scipy .optimize import NonlinearConstraint
@@ -138,8 +137,6 @@ def __init__(
138137 raise TypeError (msg )
139138 self ._bounds_transformer .initialize (self ._space )
140139
141- self ._sorting_warning_already_shown = False # TODO: remove in future version
142-
143140 # Initialize logger
144141 self .logger = ScreenLogger (verbose = self ._verbose , is_constrained = self .is_constrained )
145142
@@ -278,17 +275,6 @@ def register(
278275 constraint_value: float or None
279276 Value of the constraint function at the observation, if any.
280277 """
281- # TODO: remove in future version
282- if isinstance (params , np .ndarray ) and not self ._sorting_warning_already_shown :
283- msg = (
284- "You're attempting to register an np.ndarray. In previous versions, the optimizer internally"
285- " sorted parameters by key and expected any registered array to respect this order."
286- " In the current and any future version the order as given by the pbounds dictionary will be"
287- " used. If you wish to retain sorted parameters, please manually sort your pbounds"
288- " dictionary before constructing the optimizer."
289- )
290- warn (msg , stacklevel = 1 )
291- self ._sorting_warning_already_shown = True
292278 self ._space .register (params , target , constraint_value )
293279 self .logger .log_optimization_step (
294280 self ._space .keys , self ._space .res ()[- 1 ], self ._space .params_config , self .max
@@ -308,18 +294,6 @@ def probe(self, params: ParamsType, lazy: bool = True) -> None:
308294 If True, the optimizer will evaluate the points when calling
309295 maximize(). Otherwise it will evaluate it at the moment.
310296 """
311- # TODO: remove in future version
312- if isinstance (params , np .ndarray ) and not self ._sorting_warning_already_shown :
313- msg = (
314- "You're attempting to register an np.ndarray. In previous versions, the optimizer internally"
315- " sorted parameters by key and expected any registered array to respect this order."
316- " In the current and any future version the order as given by the pbounds dictionary will be"
317- " used. If you wish to retain sorted parameters, please manually sort your pbounds"
318- " dictionary before constructing the optimizer."
319- )
320- warn (msg , stacklevel = 1 )
321- self ._sorting_warning_already_shown = True
322- params = self ._space .array_to_params (params )
323297 if lazy :
324298 self ._queue .append (params )
325299 else :
0 commit comments