bayesian-optimization 3.0.1__tar.gz → 3.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/PKG-INFO +26 -11
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/acquisition.py +33 -0
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/bayesian_optimization.py +7 -13
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/constraint.py +1 -1
- bayesian_optimization-3.1.0/pyproject.toml +59 -0
- bayesian_optimization-3.0.1/pyproject.toml +0 -70
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/LICENSE +0 -0
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/README.md +0 -0
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/__init__.py +2 -2
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/domain_reduction.py +0 -0
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/exception.py +1 -1
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/logger.py +0 -0
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/parameter.py +0 -0
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/py.typed +0 -0
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/target_space.py +0 -0
- {bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/util.py +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: bayesian-optimization
|
|
3
|
-
Version: 3.0
|
|
3
|
+
Version: 3.1.0
|
|
4
4
|
Summary: Bayesian Optimization package
|
|
5
|
+
Author: Fernando Nogueira
|
|
6
|
+
Author-email: Fernando Nogueira <fmfnogueira@gmail.com>
|
|
5
7
|
License: The MIT License (MIT)
|
|
6
8
|
|
|
7
9
|
Copyright (c) 2014 Fernando M. F. Nogueira
|
|
@@ -11,9 +13,6 @@ License: The MIT License (MIT)
|
|
|
11
13
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
12
14
|
|
|
13
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
14
|
-
Author: Fernando Nogueira
|
|
15
|
-
Author-email: fmfnogueira@gmail.com
|
|
16
|
-
Requires-Python: >=3.9,<4.0
|
|
17
16
|
Classifier: License :: OSI Approved :: MIT License
|
|
18
17
|
Classifier: Programming Language :: Python
|
|
19
18
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -22,12 +21,29 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
-
Requires-Dist: colorama
|
|
26
|
-
Requires-Dist: numpy
|
|
27
|
-
Requires-Dist: numpy
|
|
28
|
-
Requires-Dist: scikit-learn
|
|
29
|
-
Requires-Dist: scipy
|
|
30
|
-
Requires-Dist: scipy
|
|
24
|
+
Requires-Dist: colorama>=0.4.6
|
|
25
|
+
Requires-Dist: numpy>=1.25 ; python_full_version < '3.13'
|
|
26
|
+
Requires-Dist: numpy>=2.1.3 ; python_full_version >= '3.13'
|
|
27
|
+
Requires-Dist: scikit-learn>=1.0.0
|
|
28
|
+
Requires-Dist: scipy>=1.0.0 ; python_full_version < '3.13'
|
|
29
|
+
Requires-Dist: scipy>=1.14.1 ; python_full_version >= '3.13'
|
|
30
|
+
Requires-Dist: coverage>=7.4.1 ; extra == 'dev'
|
|
31
|
+
Requires-Dist: jupyter>=1.0.0 ; extra == 'dev'
|
|
32
|
+
Requires-Dist: matplotlib>=3.0 ; extra == 'dev'
|
|
33
|
+
Requires-Dist: nbconvert>=7.14.2 ; extra == 'dev'
|
|
34
|
+
Requires-Dist: nbformat>=5.9.2 ; extra == 'dev'
|
|
35
|
+
Requires-Dist: nbsphinx>=0.9.4 ; extra == 'dev'
|
|
36
|
+
Requires-Dist: pre-commit>=3.7.1 ; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest>=8.0.0 ; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest-cov>=4.1.0 ; extra == 'dev'
|
|
39
|
+
Requires-Dist: ruff>=0.12.3 ; extra == 'dev'
|
|
40
|
+
Requires-Dist: sphinx-immaterial>=0.12.0 ; extra == 'dev'
|
|
41
|
+
Requires-Dist: sphinx>=7.0.0 ; python_full_version < '3.10' and extra == 'dev'
|
|
42
|
+
Requires-Dist: sphinx>=8.0.0 ; python_full_version >= '3.10' and extra == 'dev'
|
|
43
|
+
Requires-Dist: sphinx-autodoc-typehints>=2.3.0 ; python_full_version < '3.10' and extra == 'dev'
|
|
44
|
+
Requires-Dist: sphinx-autodoc-typehints>=2.4.0 ; python_full_version >= '3.10' and extra == 'dev'
|
|
45
|
+
Requires-Python: >=3.9
|
|
46
|
+
Provides-Extra: dev
|
|
31
47
|
Description-Content-Type: text/markdown
|
|
32
48
|
|
|
33
49
|
<div align="center">
|
|
@@ -230,4 +246,3 @@ For optimization over non-float parameters:
|
|
|
230
246
|
publisher={Elsevier}
|
|
231
247
|
}
|
|
232
248
|
```
|
|
233
|
-
|
|
@@ -452,6 +452,14 @@ class UpperConfidenceBound(AcquisitionFunction):
|
|
|
452
452
|
if kappa < 0:
|
|
453
453
|
error_msg = "kappa must be greater than or equal to 0."
|
|
454
454
|
raise ValueError(error_msg)
|
|
455
|
+
if exploration_decay is not None and not (0 < exploration_decay <= 1):
|
|
456
|
+
error_msg = "exploration_decay must be greater than 0 and less than or equal to 1."
|
|
457
|
+
raise ValueError(error_msg)
|
|
458
|
+
if exploration_decay_delay is not None and (
|
|
459
|
+
not isinstance(exploration_decay_delay, int) or exploration_decay_delay < 0
|
|
460
|
+
):
|
|
461
|
+
error_msg = "exploration_decay_delay must be an integer greater than or equal to 0."
|
|
462
|
+
raise ValueError(error_msg)
|
|
455
463
|
|
|
456
464
|
super().__init__(random_state=random_state)
|
|
457
465
|
self.kappa = kappa
|
|
@@ -604,6 +612,18 @@ class ProbabilityOfImprovement(AcquisitionFunction):
|
|
|
604
612
|
exploration_decay_delay: int | None = None,
|
|
605
613
|
random_state: int | RandomState | None = None,
|
|
606
614
|
) -> None:
|
|
615
|
+
if xi < 0:
|
|
616
|
+
error_msg = "xi must be greater than or equal to 0."
|
|
617
|
+
raise ValueError(error_msg)
|
|
618
|
+
if exploration_decay is not None and not (0 < exploration_decay <= 1):
|
|
619
|
+
error_msg = "exploration_decay must be greater than 0 and less than or equal to 1."
|
|
620
|
+
raise ValueError(error_msg)
|
|
621
|
+
if exploration_decay_delay is not None and (
|
|
622
|
+
not isinstance(exploration_decay_delay, int) or exploration_decay_delay < 0
|
|
623
|
+
):
|
|
624
|
+
error_msg = "exploration_decay_delay must be an integer greater than or equal to 0."
|
|
625
|
+
raise ValueError(error_msg)
|
|
626
|
+
|
|
607
627
|
super().__init__(random_state=random_state)
|
|
608
628
|
self.xi = xi
|
|
609
629
|
self.exploration_decay = exploration_decay
|
|
@@ -766,6 +786,7 @@ class ExpectedImprovement(AcquisitionFunction):
|
|
|
766
786
|
Decay rate for xi. If None, no decay is applied.
|
|
767
787
|
|
|
768
788
|
exploration_decay_delay : int, default None
|
|
789
|
+
Delay for decay. If None, decay is applied from the start.
|
|
769
790
|
|
|
770
791
|
random_state : int, RandomState, default None
|
|
771
792
|
Set the random state for reproducibility.
|
|
@@ -778,6 +799,18 @@ class ExpectedImprovement(AcquisitionFunction):
|
|
|
778
799
|
exploration_decay_delay: int | None = None,
|
|
779
800
|
random_state: int | RandomState | None = None,
|
|
780
801
|
) -> None:
|
|
802
|
+
if xi < 0:
|
|
803
|
+
error_msg = "xi must be greater than or equal to 0."
|
|
804
|
+
raise ValueError(error_msg)
|
|
805
|
+
if exploration_decay is not None and not (0 < exploration_decay <= 1):
|
|
806
|
+
error_msg = "exploration_decay must be greater than 0 and less than or equal to 1."
|
|
807
|
+
raise ValueError(error_msg)
|
|
808
|
+
if exploration_decay_delay is not None and (
|
|
809
|
+
not isinstance(exploration_decay_delay, int) or exploration_decay_delay < 0
|
|
810
|
+
):
|
|
811
|
+
error_msg = "exploration_decay_delay must be an integer greater than or equal to 0."
|
|
812
|
+
raise ValueError(error_msg)
|
|
813
|
+
|
|
781
814
|
super().__init__(random_state=random_state)
|
|
782
815
|
self.xi = xi
|
|
783
816
|
self.exploration_decay = exploration_decay
|
{bayesian_optimization-3.0.1 → bayesian_optimization-3.1.0}/bayes_opt/bayesian_optimization.py
RENAMED
|
@@ -55,6 +55,11 @@ class BayesianOptimization:
|
|
|
55
55
|
Dictionary with parameters names as keys and a tuple with minimum
|
|
56
56
|
and maximum values.
|
|
57
57
|
|
|
58
|
+
acquisition_function: AcquisitionFunction, optional(default=None)
|
|
59
|
+
The acquisition function to use for suggesting new points to evaluate.
|
|
60
|
+
If None, defaults to UpperConfidenceBound for unconstrained problems
|
|
61
|
+
and ExpectedImprovement for constrained problems.
|
|
62
|
+
|
|
58
63
|
constraint: NonlinearConstraint.
|
|
59
64
|
Note that the names of arguments of the constraint function and of
|
|
60
65
|
f need to be the same.
|
|
@@ -347,19 +352,7 @@ class BayesianOptimization:
|
|
|
347
352
|
----------
|
|
348
353
|
path : str or PathLike
|
|
349
354
|
Path to save the optimization state
|
|
350
|
-
|
|
351
|
-
Raises
|
|
352
|
-
------
|
|
353
|
-
ValueError
|
|
354
|
-
If attempting to save state before collecting any samples.
|
|
355
355
|
"""
|
|
356
|
-
if len(self._space) == 0:
|
|
357
|
-
msg = (
|
|
358
|
-
"Cannot save optimizer state before collecting any samples. "
|
|
359
|
-
"Please probe or register at least one point before saving."
|
|
360
|
-
)
|
|
361
|
-
raise ValueError(msg)
|
|
362
|
-
|
|
363
356
|
random_state = None
|
|
364
357
|
if self._random_state is not None:
|
|
365
358
|
state_tuple = self._random_state.get_state()
|
|
@@ -438,7 +431,8 @@ class BayesianOptimization:
|
|
|
438
431
|
# Set the GP parameters
|
|
439
432
|
self.set_gp_params(**gp_params)
|
|
440
433
|
|
|
441
|
-
|
|
434
|
+
if len(self._space):
|
|
435
|
+
self._gp.fit(self._space.params, self._space.target)
|
|
442
436
|
|
|
443
437
|
if state["random_state"] is not None:
|
|
444
438
|
random_state_tuple = (
|
|
@@ -240,7 +240,7 @@ class ConstraintModel:
|
|
|
240
240
|
return self._model[0].predict(X).reshape(X_shape[:-1])
|
|
241
241
|
|
|
242
242
|
result = np.column_stack([gp.predict(X) for gp in self._model])
|
|
243
|
-
return result.reshape(X_shape[:-1]
|
|
243
|
+
return result.reshape(*X_shape[:-1], len(self._lb))
|
|
244
244
|
|
|
245
245
|
def allowed(self, constraint_values: NDArray[Float]) -> NDArray[np.bool_]:
|
|
246
246
|
"""Check whether `constraint_values` fulfills the specified limits.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "bayesian-optimization"
|
|
3
|
+
version = "3.1.0"
|
|
4
|
+
description = "Bayesian Optimization package"
|
|
5
|
+
authors = [{ name = "Fernando Nogueira", email = "fmfnogueira@gmail.com" }]
|
|
6
|
+
license = { file = "LICENSE" }
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
requires-python = ">=3.9"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"License :: OSI Approved :: MIT License",
|
|
11
|
+
"Programming Language :: Python",
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Programming Language :: Python :: 3.9",
|
|
14
|
+
"Programming Language :: Python :: 3.10",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"colorama>=0.4.6",
|
|
21
|
+
"numpy>=1.25; python_version<'3.13'",
|
|
22
|
+
"numpy>=2.1.3; python_version>='3.13'",
|
|
23
|
+
"scikit-learn>=1.0.0",
|
|
24
|
+
"scipy>=1.0.0; python_version<'3.13'",
|
|
25
|
+
"scipy>=1.14.1; python_version>='3.13'",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
dev = [
|
|
30
|
+
"coverage>=7.4.1",
|
|
31
|
+
"jupyter>=1.0.0",
|
|
32
|
+
"matplotlib>=3.0",
|
|
33
|
+
"nbconvert>=7.14.2",
|
|
34
|
+
"nbformat>=5.9.2",
|
|
35
|
+
"nbsphinx>=0.9.4",
|
|
36
|
+
"pre-commit>=3.7.1",
|
|
37
|
+
"pytest>=8.0.0",
|
|
38
|
+
"pytest-cov>=4.1.0",
|
|
39
|
+
"ruff>=0.12.3",
|
|
40
|
+
"sphinx-immaterial>=0.12.0",
|
|
41
|
+
"sphinx>=7.0.0; python_version<'3.10'",
|
|
42
|
+
"sphinx>=8.0.0; python_version>='3.10'",
|
|
43
|
+
"sphinx-autodoc-typehints>=2.3.0; python_version<'3.10'",
|
|
44
|
+
"sphinx-autodoc-typehints>=2.4.0; python_version>='3.10'",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[build-system]
|
|
48
|
+
requires = ["uv_build>=0.7.21,<0.8.0"]
|
|
49
|
+
build-backend = "uv_build"
|
|
50
|
+
|
|
51
|
+
[tool.uv.build-backend]
|
|
52
|
+
module-name = "bayes_opt"
|
|
53
|
+
module-root = ""
|
|
54
|
+
|
|
55
|
+
[tool.coverage.report]
|
|
56
|
+
exclude_lines = [
|
|
57
|
+
"pragma: no cover",
|
|
58
|
+
"if TYPE_CHECKING:",
|
|
59
|
+
]
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "bayesian-optimization"
|
|
3
|
-
version = "3.0.1"
|
|
4
|
-
description = "Bayesian Optimization package"
|
|
5
|
-
authors = [{ name = "Fernando Nogueira", email = "fmfnogueira@gmail.com" }]
|
|
6
|
-
license = { file = "LICENSE" }
|
|
7
|
-
readme = "README.md"
|
|
8
|
-
requires-python = ">=3.9,<4.0"
|
|
9
|
-
classifiers = [
|
|
10
|
-
"License :: OSI Approved :: MIT License",
|
|
11
|
-
"Programming Language :: Python",
|
|
12
|
-
"Programming Language :: Python :: 3",
|
|
13
|
-
"Programming Language :: Python :: 3.9",
|
|
14
|
-
"Programming Language :: Python :: 3.10",
|
|
15
|
-
"Programming Language :: Python :: 3.11",
|
|
16
|
-
"Programming Language :: Python :: 3.12",
|
|
17
|
-
"Programming Language :: Python :: 3.13",
|
|
18
|
-
]
|
|
19
|
-
dependencies = [
|
|
20
|
-
"scikit-learn>=1.0.0,<2.0.0",
|
|
21
|
-
"numpy>=1.25; python_version<'3.13'",
|
|
22
|
-
"numpy>=2.1.3; python_version>='3.13'",
|
|
23
|
-
"scipy>=1.0.0,<2.0.0; python_version<'3.13'",
|
|
24
|
-
"scipy>=1.14.1,<2.0.0; python_version>='3.13'",
|
|
25
|
-
"colorama>=0.4.6,<1.0.0",
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
[tool.poetry]
|
|
29
|
-
requires-poetry = ">=2.0"
|
|
30
|
-
packages = [{ include = "bayes_opt" }]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
[tool.poetry.group.dev] # for testing/developing
|
|
34
|
-
optional = true
|
|
35
|
-
[tool.poetry.group.dev.dependencies]
|
|
36
|
-
pytest = "^8.0.0"
|
|
37
|
-
pytest-cov = "^4.1.0"
|
|
38
|
-
coverage = "^7.4.1"
|
|
39
|
-
ruff = "0.6.6"
|
|
40
|
-
pre-commit = "^3.7.1"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
[tool.poetry.group.nbtools] # for running/converting notebooks
|
|
44
|
-
optional = true
|
|
45
|
-
[tool.poetry.group.nbtools.dependencies]
|
|
46
|
-
nbformat = "^5.9.2"
|
|
47
|
-
nbconvert = "^7.14.2"
|
|
48
|
-
jupyter = "^1.0.0"
|
|
49
|
-
matplotlib = "^3.0"
|
|
50
|
-
nbsphinx = "^0.9.4"
|
|
51
|
-
sphinx-immaterial = "^0.12.0"
|
|
52
|
-
sphinx = [
|
|
53
|
-
{ version = "^7.0.0", python = "<3.10" },
|
|
54
|
-
{ version = "^8.0.0", python = ">=3.10" },
|
|
55
|
-
]
|
|
56
|
-
sphinx-autodoc-typehints = [
|
|
57
|
-
{ version = "^2.3.0", python = "<3.10" },
|
|
58
|
-
{ version = "^2.4.0", python = ">=3.10" },
|
|
59
|
-
]
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
[build-system]
|
|
63
|
-
requires = ["poetry-core>=2.0"]
|
|
64
|
-
build-backend = "poetry.core.masonry.api"
|
|
65
|
-
|
|
66
|
-
[tool.coverage.report]
|
|
67
|
-
exclude_lines = [
|
|
68
|
-
"pragma: no cover",
|
|
69
|
-
"if TYPE_CHECKING:",
|
|
70
|
-
]
|
|
File without changes
|
|
File without changes
|
|
@@ -15,10 +15,10 @@ __version__ = importlib.metadata.version("bayesian-optimization")
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
__all__ = [
|
|
18
|
-
"acquisition",
|
|
19
18
|
"BayesianOptimization",
|
|
20
|
-
"TargetSpace",
|
|
21
19
|
"ConstraintModel",
|
|
22
20
|
"ScreenLogger",
|
|
23
21
|
"SequentialDomainReductionTransformer",
|
|
22
|
+
"TargetSpace",
|
|
23
|
+
"acquisition",
|
|
24
24
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|