Skip to content

Commit 7ddd1c2

Browse files
committed
DOC: Update docs on minimize(bounds=), stressing the role of integers
1 parent 255713f commit 7ddd1c2

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

sambo/_minimize.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,30 @@ def minimize(
4848
Bounds for parameter variables.
4949
Should be a sequence of (min, max) pairs for each dimension,
5050
or an enumeration of nominal values. For any dimension,
51-
if `min` and `max` are integers, the dimension is assumed to be _integral_.
52-
If `min` or `max` are floats, the dimension is assumed to be _real_.
53-
In all other cases including if more than two values are provided,
54-
the dimension is assumed to be an _enumeration_ of values.
51+
**if `min` and `max` are integers**, the dimension is assumed to be _integral_
52+
on interval `[min, max)` (see warning below).
53+
If `min` or `max` are **floats**, the dimension is assumed to be _real_.
54+
In all other cases including if more than two values are specified,
55+
the dimension is assumed to be that ([nominal]) _enumeration_ of values.
5556
See _Examples_ below.
5657
5758
.. note:: Nominals are represented as ordinals
58-
Categorical (nominal) enumerations, although often not inherently ordered,
59+
Categorical ([nominal]) enumerations, although often not inherently ordered,
5960
are internally represented as integral dimensions.
6061
If this appears to significantly affect your results
6162
(e.g. if your nominals span many cases),
6263
you may need to [one-hot encode] your nominal variables manually.
6364
65+
[nominal]: https://en.wikipedia.org/wiki/Level_of_measurement#Nominal_level
6466
[one-hot encode]: https://en.wikipedia.org/wiki/One-hot
6567
6668
.. warning:: Mind the dot
6769
If optimizing your problem fails to produce expected results,
6870
make sure you're not specifying integer dimensions where real
69-
floating values would make more sense.
71+
(floating) values are expected. E.g.:
72+
73+
bounds = [(-2, 2)] * 2 # A 2D grid of {-2, -1, 0, 1}²
74+
bounds = [(-2., 2.)] # A 1D dimension of ~ np.linspace(-2., 2., 1/eps)
7075
7176
constraints : Callable[[np.ndarray], bool], optional
7277
Function representing constraints.

0 commit comments

Comments
 (0)