@@ -95,7 +95,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
9595< details class ="source ">
9696< summary >
9797< span > Expand source code</ span >
98- < a href ="https://github.com/sambo-optimization/sambo/blob/37d8fe3556e4acf30e34eccdd61c70ae28eb3122 /sambo/_minimize.py#L12-L216 " class ="git-link " target ="_blank "> Browse git</ a >
98+ < a href ="https://github.com/sambo-optimization/sambo/blob/38d5794db298ccc27527594e6b54c7c1106e63be /sambo/_minimize.py#L12-L231 " class ="git-link " target ="_blank "> Browse git</ a >
9999</ summary >
100100< pre > < code class ="python "> def minimize(
101101 fun: Callable[[np.ndarray], float],
@@ -163,31 +163,45 @@ <h2 class="section-title" id="header-functions">Functions</h2>
163163 >>> minimize(..., constraints=lambda x: (lb < x <= ub))
164164
165165 max_iter : int, optional
166- Maximum number of iterations allowed.
166+ Maximum number of iterations (objective function evaluations) allowed.
167167
168168 method : {'shgo', 'sceua', 'smbo'}, default='shgo'
169169 Global optimization algorithm to use. Options are:
170170
171- * `"shgo"` – [simplical homology global optimization] (SHGO; from SciPy),
172- * `"smbo"` – surrogate model-based optimization, for which you can pass
173- your own `estimator=` (see `**kwargs`).
171+ * `"shgo"` – [simplicial homology global optimization] (SHGO; from SciPy),
172+ [assures quick convergence] to global minimum for Lipschitz-smooth functions;
173+ * `"smbo"` – [surrogate model-based optimization], for which you can pass
174+ your own `estimator=` (see `**kwargs`), robust, but slowest of the bunch;
174175 * `"sceua"` – [shuffled complex evolution (SCE-UA)] (with a few tweaks,
175- marked in the source).
176-
177- [simplical homology global optimization]: http://doi.org/10.1007/s10898-018-0645-y
176+ marked in the source), a good, time-tested all-around algorithm
177+ similar to [Nelder-Mead],
178+ provided it's initialized with sufficient `n_complexes` and `complex_size`
179+ kwargs ([canonical literature] suggests reference values
180+ `n_complexes >= 3 * len(bounds)` and
181+ `complex_size = 2 * len(bounds) + 1`,
182+ but we find good performance using `complex_size=2`,
183+ allowing for more complexes and more complex evolutions for given `max_iter`).
184+
185+ [simplicial homology global optimization]: http://doi.org/10.1007/s10898-018-0645-y
186+ [assures quick convergence]: https://shgo.readthedocs.io/en/latest/docs/README.html#simplicial-homology-global-optimisation-theory
187+ [surrogate model-based optimization]: https://en.wikipedia.org/wiki/Surrogate_model
178188 [shuffled complex evolution (SCE-UA)]: https://doi.org/10.1007/BF00939380
189+ [Nelder-Mead]: https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method
190+ [canonical literature]: https://doi.org/10.1016/0022-1694(94)90057-4
179191
180192 .. caution:: Default method SHGO is only appropriate for Lipschitz-smooth functions
181193 Smooth functions have gradients that vary gradually, while non-smooth functions
182- exhibit abrupt changes (e.g. with nominal variables),
183- sharp corners (e.g. function `abs()`), discontinuities (e.g. function `tan()`),
194+ exhibit abrupt changes (e.g. neighboring values of categorical variables),
195+ sharp corners (e.g. function `abs()`),
196+ discontinuities (e.g. function `tan()`),
184197 or unbounded growth (e.g. function `exp()`).
185198
186199 If your objective function is more of the latter kind,
187- you might need to use one of the other methods.
200+ you might prefer to set one of the other methods.
188201
189- n_iter_no_change : int, default 10
202+ n_iter_no_change : int, optional
190203 Number of iterations with no improvement before stopping.
204+ Default is method-dependent.
191205
192206 tol : float, default FLOAT32_PRECISION
193207 Tolerance for convergence. Optimization stops when
@@ -212,7 +226,8 @@ <h2 class="section-title" id="header-functions">Functions</h2>
212226 Random number generator or seed for reproducibility.
213227
214228 **kwargs : dict, optional
215- Additional parameters to pass to optimization function. Popular options are:
229+ Additional optional parameters to pass to optimization function.
230+ Popular options are:
216231
217232 * for `method="shgo"`: `n_init` (number of initial points),
218233 * for `method="smbo"`: `n_init`, `n_candidates`, `n_models`, `estimator`
@@ -345,29 +360,39 @@ <h2 id="parameters">Parameters</h2>
345360</ code > </ pre >
346361</ dd >
347362< dt > < strong > < code > max_iter</ code > </ strong > : < code > int</ code > , optional</ dt >
348- < dd > Maximum number of iterations allowed.</ dd >
363+ < dd > Maximum number of iterations (objective function evaluations) allowed.</ dd >
349364< dt > < strong > < code > method</ code > </ strong > : < code > {'shgo', 'sceua', 'smbo'}</ code > , default=< code > 'shgo'</ code > </ dt >
350365< dd >
351366< p > Global optimization algorithm to use. Options are:</ p >
352367< ul >
353- < li > < code > "shgo"</ code > – < a href ="http://doi.org/10.1007/s10898-018-0645-y "> simplical homology global optimization</ a > (SHGO; from SciPy),</ li >
354- < li > < code > "smbo"</ code > – surrogate model-based optimization, for which you can pass
355- your own < code > estimator=</ code > (see < code > **kwargs</ code > ).</ li >
368+ < li > < code > "shgo"</ code > – < a href ="http://doi.org/10.1007/s10898-018-0645-y "> simplicial homology global optimization</ a > (SHGO; from SciPy),
369+ < a href ="https://shgo.readthedocs.io/en/latest/docs/README.html#simplicial-homology-global-optimisation-theory "> assures quick convergence</ a > to global minimum for Lipschitz-smooth functions;</ li >
370+ < li > < code > "smbo"</ code > – < a href ="https://en.wikipedia.org/wiki/Surrogate_model "> surrogate model-based optimization</ a > , for which you can pass
371+ your own < code > estimator=</ code > (see < code > **kwargs</ code > ), robust, but slowest of the bunch;</ li >
356372< li > < code > "sceua"</ code > – < a href ="https://doi.org/10.1007/BF00939380 "> shuffled complex evolution (SCE-UA)</ a > (with a few tweaks,
357- marked in the source).</ li >
373+ marked in the source), a good, time-tested all-around algorithm
374+ similar to < a href ="https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method "> Nelder-Mead</ a > ,
375+ provided it's initialized with sufficient < code > n_complexes</ code > and < code > complex_size</ code >
376+ kwargs (< a href ="https://doi.org/10.1016/0022-1694(94)90057-4 "> canonical literature</ a > suggests reference values
377+ < code > n_complexes >= 3 * len(bounds)</ code > and
378+ < code > complex_size = 2 * len(bounds) + 1</ code > ,
379+ but we find good performance using < code > complex_size=2</ code > ,
380+ allowing for more complexes and more complex evolutions for given < code > max_iter</ code > ).</ li >
358381</ ul >
359382< div class ="admonition caution ">
360383< p class ="admonition-title "> Caution: Default method SHGO is only appropriate for Lipschitz-smooth functions</ p >
361384< p > Smooth functions have gradients that vary gradually, while non-smooth functions
362- exhibit abrupt changes (e.g. with nominal variables),
363- sharp corners (e.g. function < code > abs()</ code > ), discontinuities (e.g. function < code > tan()</ code > ),
385+ exhibit abrupt changes (e.g. neighboring values of categorical variables),
386+ sharp corners (e.g. function < code > abs()</ code > ),
387+ discontinuities (e.g. function < code > tan()</ code > ),
364388or unbounded growth (e.g. function < code > exp()</ code > ).</ p >
365389< p > If your objective function is more of the latter kind,
366- you might need to use one of the other methods.</ p >
390+ you might prefer to set one of the other methods.</ p >
367391</ div >
368392</ dd >
369- < dt > < strong > < code > n_iter_no_change</ code > </ strong > : < code > int</ code > , default < code > 10</ code > </ dt >
370- < dd > Number of iterations with no improvement before stopping.</ dd >
393+ < dt > < strong > < code > n_iter_no_change</ code > </ strong > : < code > int</ code > , optional</ dt >
394+ < dd > Number of iterations with no improvement before stopping.
395+ Default is method-dependent.</ dd >
371396< dt > < strong > < code > tol</ code > </ strong > : < code > float</ code > , default < code > FLOAT32_PRECISION</ code > </ dt >
372397< dd > Tolerance for convergence. Optimization stops when
373398found optimum improvements are below this threshold.</ dd >
@@ -386,7 +411,8 @@ <h2 id="parameters">Parameters</h2>
386411< dd > Random number generator or seed for reproducibility.</ dd >
387412< dt > < strong > < code > **kwargs</ code > </ strong > : < code > dict</ code > , optional</ dt >
388413< dd >
389- < p > Additional parameters to pass to optimization function. Popular options are:</ p >
414+ < p > Additional optional parameters to pass to optimization function.
415+ Popular options are:</ p >
390416< ul >
391417< li > for < code > method="shgo"</ code > : < code > n_init</ code > (number of initial points),</ li >
392418< li > for < code > method="smbo"</ code > : < code > n_init</ code > , < code > n_candidates</ code > , < code > n_models</ code > , < code > estimator</ code >
@@ -455,7 +481,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
455481< details class ="source ">
456482< summary >
457483< span > Expand source code</ span >
458- < a href ="https://github.com/sambo-optimization/sambo/blob/37d8fe3556e4acf30e34eccdd61c70ae28eb3122 /sambo/_util.py#L89-L102 " class ="git-link " target ="_blank "> Browse git</ a >
484+ < a href ="https://github.com/sambo-optimization/sambo/blob/38d5794db298ccc27527594e6b54c7c1106e63be /sambo/_util.py#L89-L102 " class ="git-link " target ="_blank "> Browse git</ a >
459485</ summary >
460486< pre > < code class ="python "> class OptimizeResult(_OptimizeResult):
461487 """
@@ -528,7 +554,7 @@ <h3>Class variables</h3>
528554< details class ="source ">
529555< summary >
530556< span > Expand source code</ span >
531- < a href ="https://github.com/sambo-optimization/sambo/blob/37d8fe3556e4acf30e34eccdd61c70ae28eb3122 /sambo/_smbo.py#L21-L524 " class ="git-link " target ="_blank "> Browse git</ a >
557+ < a href ="https://github.com/sambo-optimization/sambo/blob/38d5794db298ccc27527594e6b54c7c1106e63be /sambo/_smbo.py#L21-L524 " class ="git-link " target ="_blank "> Browse git</ a >
532558</ summary >
533559< pre > < code class ="python "> class Optimizer:
534560 """
@@ -584,7 +610,7 @@ <h3>Class variables</h3>
584610 or "gb" (gradient boosting).
585611
586612 You can also provide your own regressor with a scikit-learn API,
587- namely `fit()` and `predict()` methods.
613+ ( namely `fit()` and `predict()` methods) .
588614
589615 y0 : float or tuple[float], optional
590616 Initial value(s) of the objective function corresponding to `x0`.
@@ -1076,7 +1102,7 @@ <h2 id="parameters">Parameters</h2>
10761102Popular options include "gp" (Gaussian process), "et" (extra trees),
10771103or "gb" (gradient boosting).</ p >
10781104< p > You can also provide your own regressor with a scikit-learn API,
1079- namely < code > fit()</ code > and < code > predict()</ code > methods.</ p >
1105+ ( namely < code > fit()</ code > and < code > predict()</ code > methods) .</ p >
10801106</ dd >
10811107< dt > < strong > < code > y0</ code > </ strong > : < code > float</ code > or < code > tuple[float]</ code > , optional</ dt >
10821108< dd > Initial value(s) of the objective function corresponding to < code > x0</ code > .</ dd >
@@ -1129,7 +1155,7 @@ <h3>Methods</h3>
11291155< details class ="source ">
11301156< summary >
11311157< span > Expand source code</ span >
1132- < a href ="https://github.com/sambo-optimization/sambo/blob/37d8fe3556e4acf30e34eccdd61c70ae28eb3122 /sambo/_smbo.py#L277-L343 " class ="git-link " target ="_blank "> Browse git</ a >
1158+ < a href ="https://github.com/sambo-optimization/sambo/blob/38d5794db298ccc27527594e6b54c7c1106e63be /sambo/_smbo.py#L277-L343 " class ="git-link " target ="_blank "> Browse git</ a >
11331159</ summary >
11341160< pre > < code class ="python "> def ask(
11351161 self,
@@ -1247,7 +1273,7 @@ <h2 id="examples">Examples</h2>
12471273< details class ="source ">
12481274< summary >
12491275< span > Expand source code</ span >
1250- < a href ="https://github.com/sambo-optimization/sambo/blob/37d8fe3556e4acf30e34eccdd61c70ae28eb3122 /sambo/_smbo.py#L397-L494 " class ="git-link " target ="_blank "> Browse git</ a >
1276+ < a href ="https://github.com/sambo-optimization/sambo/blob/38d5794db298ccc27527594e6b54c7c1106e63be /sambo/_smbo.py#L397-L494 " class ="git-link " target ="_blank "> Browse git</ a >
12511277</ summary >
12521278< pre > < code class ="python "> def run(self, *,
12531279 max_iter: Optional[int] = None,
@@ -1385,7 +1411,7 @@ <h2 id="examples">Examples</h2>
13851411< details class ="source ">
13861412< summary >
13871413< span > Expand source code</ span >
1388- < a href ="https://github.com/sambo-optimization/sambo/blob/37d8fe3556e4acf30e34eccdd61c70ae28eb3122 /sambo/_smbo.py#L345-L395 " class ="git-link " target ="_blank "> Browse git</ a >
1414+ < a href ="https://github.com/sambo-optimization/sambo/blob/38d5794db298ccc27527594e6b54c7c1106e63be /sambo/_smbo.py#L345-L395 " class ="git-link " target ="_blank "> Browse git</ a >
13891415</ summary >
13901416< pre > < code class ="python "> def tell(self, y: float | list[float],
13911417 x: Optional[float | tuple[float] | list[tuple[float]]] = None):
@@ -1472,7 +1498,7 @@ <h2 id="examples">Examples</h2>
14721498< details class ="source ">
14731499< summary >
14741500< span > Expand source code</ span >
1475- < a href ="https://github.com/sambo-optimization/sambo/blob/37d8fe3556e4acf30e34eccdd61c70ae28eb3122 /sambo/_smbo.py#L496-L524 " class ="git-link " target ="_blank "> Browse git</ a >
1501+ < a href ="https://github.com/sambo-optimization/sambo/blob/38d5794db298ccc27527594e6b54c7c1106e63be /sambo/_smbo.py#L496-L524 " class ="git-link " target ="_blank "> Browse git</ a >
14761502</ summary >
14771503< pre > < code class ="python "> def top_k(self, k: int = 1):
14781504 """
@@ -1536,7 +1562,7 @@ <h2 id="examples">Examples</h2>
15361562< details class ="source ">
15371563< summary >
15381564< span > Expand source code</ span >
1539- < a href ="https://github.com/sambo-optimization/sambo/blob/37d8fe3556e4acf30e34eccdd61c70ae28eb3122 /sambo/_estimators.py#L98-L185 " class ="git-link " target ="_blank "> Browse git</ a >
1565+ < a href ="https://github.com/sambo-optimization/sambo/blob/38d5794db298ccc27527594e6b54c7c1106e63be /sambo/_estimators.py#L98-L185 " class ="git-link " target ="_blank "> Browse git</ a >
15401566</ summary >
15411567< pre > < code class ="python "> class SamboSearchCV(BaseSearchCV):
15421568 """
0 commit comments