squlearn 0.7.3__tar.gz → 0.7.4__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.
Files changed (161) hide show
  1. {squlearn-0.7.3 → squlearn-0.7.4}/CITATION.cff +2 -1
  2. {squlearn-0.7.3 → squlearn-0.7.4}/PKG-INFO +2 -2
  3. {squlearn-0.7.3 → squlearn-0.7.4}/pyproject.toml +1 -1
  4. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/__init__.py +1 -1
  5. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/sglbo.py +28 -87
  6. {squlearn-0.7.3 → squlearn-0.7.4}/.github/CODE_OF_CONDUCT.md +0 -0
  7. {squlearn-0.7.3 → squlearn-0.7.4}/.github/CONTRIBUTING.md +0 -0
  8. {squlearn-0.7.3 → squlearn-0.7.4}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  9. {squlearn-0.7.3 → squlearn-0.7.4}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  10. {squlearn-0.7.3 → squlearn-0.7.4}/.github/workflows/doc_checks.yml +0 -0
  11. {squlearn-0.7.3 → squlearn-0.7.4}/.github/workflows/format.yml +0 -0
  12. {squlearn-0.7.3 → squlearn-0.7.4}/.github/workflows/publish.yml +0 -0
  13. {squlearn-0.7.3 → squlearn-0.7.4}/.github/workflows/publish_docs.yml +0 -0
  14. {squlearn-0.7.3 → squlearn-0.7.4}/.github/workflows/tests.yaml +0 -0
  15. {squlearn-0.7.3 → squlearn-0.7.4}/.gitignore +0 -0
  16. {squlearn-0.7.3 → squlearn-0.7.4}/LICENSE.txt +0 -0
  17. {squlearn-0.7.3 → squlearn-0.7.4}/README.md +0 -0
  18. {squlearn-0.7.3 → squlearn-0.7.4}/docs/Makefile +0 -0
  19. {squlearn-0.7.3 → squlearn-0.7.4}/docs/README.md +0 -0
  20. {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/css/custom.css +0 -0
  21. {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/favicon.png +0 -0
  22. {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/logo.png +0 -0
  23. {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/qnn/qnn.svg +0 -0
  24. {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/schematic.png +0 -0
  25. {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/util/executor.png +0 -0
  26. {squlearn-0.7.3 → squlearn-0.7.4}/docs/_templates/class.rst +0 -0
  27. {squlearn-0.7.3 → squlearn-0.7.4}/docs/_templates/class_with_call.rst +0 -0
  28. {squlearn-0.7.3 → squlearn-0.7.4}/docs/_templates/function.rst +0 -0
  29. {squlearn-0.7.3 → squlearn-0.7.4}/docs/conf.py +0 -0
  30. {squlearn-0.7.3 → squlearn-0.7.4}/docs/examples/example_kernel_digit_classification.nblink +0 -0
  31. {squlearn-0.7.3 → squlearn-0.7.4}/docs/examples/example_kernel_grid_search.nblink +0 -0
  32. {squlearn-0.7.3 → squlearn-0.7.4}/docs/examples/example_qnn_backend_mitigation.nblink +0 -0
  33. {squlearn-0.7.3 → squlearn-0.7.4}/docs/examples/example_quantum_bayesian_optimization.nblink +0 -0
  34. {squlearn-0.7.3 → squlearn-0.7.4}/docs/examples/examples_index.rst +0 -0
  35. {squlearn-0.7.3 → squlearn-0.7.4}/docs/index.rst +0 -0
  36. {squlearn-0.7.3 → squlearn-0.7.4}/docs/install/install.rst +0 -0
  37. {squlearn-0.7.3 → squlearn-0.7.4}/docs/make.bat +0 -0
  38. {squlearn-0.7.3 → squlearn-0.7.4}/docs/modules/classes.rst +0 -0
  39. {squlearn-0.7.3 → squlearn-0.7.4}/docs/qiskit_settings.conf +0 -0
  40. {squlearn-0.7.3 → squlearn-0.7.4}/docs/requirements.txt +0 -0
  41. {squlearn-0.7.3 → squlearn-0.7.4}/docs/spelling_wordlist.txt +0 -0
  42. {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/encoding_circuits.rst +0 -0
  43. {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/executor.rst +0 -0
  44. {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/kernel_methods.rst +0 -0
  45. {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/observables.rst +0 -0
  46. {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/quantum_neural_networks.rst +0 -0
  47. {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/user_guide_index.rst +0 -0
  48. {squlearn-0.7.3 → squlearn-0.7.4}/examples/encoding_circuits/layered_encoding_circuit.ipynb +0 -0
  49. {squlearn-0.7.3 → squlearn-0.7.4}/examples/encoding_circuits/pruning_example.ipynb +0 -0
  50. {squlearn-0.7.3 → squlearn-0.7.4}/examples/encoding_circuits/various_encoding_circuit.ipynb +0 -0
  51. {squlearn-0.7.3 → squlearn-0.7.4}/examples/executor/example_executor_qiskit.ipynb +0 -0
  52. {squlearn-0.7.3 → squlearn-0.7.4}/examples/integration/mlflow.ipynb +0 -0
  53. {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/example_fidelity_kernel.ipynb +0 -0
  54. {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/example_projected_kernel.ipynb +0 -0
  55. {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/example_regularization_mitigation.ipynb +0 -0
  56. {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/qgpc_workflow.ipynb +0 -0
  57. {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/qgpr_optimization_workflow.ipynb +0 -0
  58. {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/qgpr_workflow.ipynb +0 -0
  59. {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/classification_example.ipynb +0 -0
  60. {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/example_adam.ipynb +0 -0
  61. {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/example_minibatch.ipynb +0 -0
  62. {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/example_qcnn_encoding_circuit.ipynb +0 -0
  63. {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/regression_example.ipynb +0 -0
  64. {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/regression_with_variance.ipynb +0 -0
  65. {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/images/encoding_circuit.png +0 -0
  66. {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/images/pipeline.png +0 -0
  67. {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/images/projected_quantum_kernel.png +0 -0
  68. {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/images/quantum_bo.png +0 -0
  69. {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/kernel_digit_classification.ipynb +0 -0
  70. {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/kernel_grid_search.ipynb +0 -0
  71. {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/kernel_regression.ipynb +0 -0
  72. {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/qnn_backend_mitigation.ipynb +0 -0
  73. {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/quantum_bayesian_optimization.ipynb +0 -0
  74. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/__init__.py +0 -0
  75. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/__init__.py +0 -0
  76. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/chebyshev_pqc.py +0 -0
  77. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/chebyshev_rx.py +0 -0
  78. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/chebyshev_tower.py +0 -0
  79. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/highdim_encoding_circuit.py +0 -0
  80. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/hubregtsen_encoding_circuit.py +0 -0
  81. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/multi_control_encoding_circuit.py +0 -0
  82. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/param_z_feature_map.py +0 -0
  83. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/qcnn_encoding_circuit.py +0 -0
  84. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/qiskit_encoding_circuit.py +0 -0
  85. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/yz_cx_encoding_circuit.py +0 -0
  86. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/encoding_circuit_base.py +0 -0
  87. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/encoding_circuit_derivatives.py +0 -0
  88. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/layered_encoding_circuit.py +0 -0
  89. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/pruned_encoding_circuit.py +0 -0
  90. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/transpiled_encoding_circuit.py +0 -0
  91. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/__init__.py +0 -0
  92. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/__init__.py +0 -0
  93. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/fidelity_kernel.py +0 -0
  94. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/fidelity_kernel_pennylane.py +0 -0
  95. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/kernel_matrix_base.py +0 -0
  96. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/kernel_util.py +0 -0
  97. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/projected_quantum_kernel.py +0 -0
  98. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/regularization.py +0 -0
  99. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/__init__.py +0 -0
  100. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/qgpc.py +0 -0
  101. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/qgpr.py +0 -0
  102. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/qkrr.py +0 -0
  103. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/qsvc.py +0 -0
  104. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/qsvr.py +0 -0
  105. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/__init__.py +0 -0
  106. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/kernel_loss_base.py +0 -0
  107. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/kernel_optimization_base.py +0 -0
  108. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/kernel_optimizer.py +0 -0
  109. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/negative_log_likelihood.py +0 -0
  110. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/target_alignment.py +0 -0
  111. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/__init__.py +0 -0
  112. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_base.py +0 -0
  113. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_derivatives.py +0 -0
  114. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/__init__.py +0 -0
  115. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/custom_observable.py +0 -0
  116. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/ising_hamiltonian.py +0 -0
  117. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/single_pauli.py +0 -0
  118. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/single_probability.py +0 -0
  119. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/summed_paulis.py +0 -0
  120. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/summed_probabilities.py +0 -0
  121. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/__init__.py +0 -0
  122. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/adam.py +0 -0
  123. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/approximated_gradients.py +0 -0
  124. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/optimizer_base.py +0 -0
  125. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/optimizers_wrapper.py +0 -0
  126. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/__init__.py +0 -0
  127. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/barren_plateau_analysis.py +0 -0
  128. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/base_qnn.py +0 -0
  129. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/loss.py +0 -0
  130. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/lowlevel_qnn.py +0 -0
  131. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/lowlevel_qnn_base.py +0 -0
  132. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/lowlevel_qnn_pennylane.py +0 -0
  133. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/lowlevel_qnn_qiskit.py +0 -0
  134. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/qnnc.py +0 -0
  135. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/qnnr.py +0 -0
  136. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/training.py +0 -0
  137. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/__init__.py +0 -0
  138. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/data_preprocessing.py +0 -0
  139. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/executor.py +0 -0
  140. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/optree/__init__.py +0 -0
  141. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/optree/optree.py +0 -0
  142. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/optree/optree_derivative.py +0 -0
  143. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/optree/optree_evaluate.py +0 -0
  144. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/pennylane/__init__.py +0 -0
  145. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/pennylane/pennylane_circuit.py +0 -0
  146. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/pennylane/pennylane_gates.py +0 -0
  147. {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/qfi.py +0 -0
  148. {squlearn-0.7.3 → squlearn-0.7.4}/tests/encoding_circuit/test_layered_encoding_circuit.py +0 -0
  149. {squlearn-0.7.3 → squlearn-0.7.4}/tests/kernel/ml/test_qgpc.py +0 -0
  150. {squlearn-0.7.3 → squlearn-0.7.4}/tests/kernel/ml/test_qgpr.py +0 -0
  151. {squlearn-0.7.3 → squlearn-0.7.4}/tests/kernel/ml/test_qkrr.py +0 -0
  152. {squlearn-0.7.3 → squlearn-0.7.4}/tests/kernel/ml/test_qsvc.py +0 -0
  153. {squlearn-0.7.3 → squlearn-0.7.4}/tests/kernel/ml/test_qsvr.py +0 -0
  154. {squlearn-0.7.3 → squlearn-0.7.4}/tests/optimizers/test_sglbo.py +0 -0
  155. {squlearn-0.7.3 → squlearn-0.7.4}/tests/qnn/test_base_qnn.py +0 -0
  156. {squlearn-0.7.3 → squlearn-0.7.4}/tests/qnn/test_qnnc.py +0 -0
  157. {squlearn-0.7.3 → squlearn-0.7.4}/tests/qnn/test_qnnr.py +0 -0
  158. {squlearn-0.7.3 → squlearn-0.7.4}/tests/qnn/test_training.py +0 -0
  159. {squlearn-0.7.3 → squlearn-0.7.4}/tests/util/optree/test_optree_derivative.py +0 -0
  160. {squlearn-0.7.3 → squlearn-0.7.4}/tests/util/optree/test_optree_evaluate.py +0 -0
  161. {squlearn-0.7.3 → squlearn-0.7.4}/tests/util/test_executor.py +0 -0
@@ -29,6 +29,7 @@ preferred-citation:
29
29
  affiliation: Fraunhofer Institute for Manufacturing Engineering and Automation IPA
30
30
  - family-names: Hagelüken
31
31
  given-names: Manuel
32
+ orcid: https://orcid.org/0009-0007-9852-3190
32
33
  affilliation: Fraunhofer Institute for Manufacturing Engineering and Automation IPA
33
34
  - family-names: Roth
34
35
  given-names: Marco
@@ -36,5 +37,5 @@ preferred-citation:
36
37
  affiliation: Fraunhofer Institute for Manufacturing Engineering and Automation IPA
37
38
  year: 2023
38
39
  month: 11
39
- doi: 10.48550/arXiv.2311.08990
40
+ doi: 10.48550/arXiv.2311.08990
40
41
  url: https://arxiv.org/abs/2311.08990
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: squlearn
3
- Version: 0.7.3
3
+ Version: 0.7.4
4
4
  Summary: A library for quantum machine learning following the scikit-learnstandard.
5
5
  Keywords: quantum,machine learning,qml
6
6
  Author-email: David Kreplin <david.kreplin@ipa.fraunhofer.de>, Moritz Willmann <moritz.willmann@ipa.fraunhofer.de>, Jan Schnabel <jan.schnabel@ipa.fraunhofer.de>, Frederic Rapp <frederic.rapp@ipa.fraunhofer.de>, Manuel Hagelüken <manuel.hagelueken@ipa.fraunhofer.de>, Marco Roth <marco.roth@ipa.fraunhofer.de>
@@ -20,7 +20,7 @@ Requires-Dist: qiskit-machine-learning>=0.6.1
20
20
  Requires-Dist: pennylane>=0.34.0
21
21
  Requires-Dist: scipy>=1.5
22
22
  Requires-Dist: scikit-learn>=1.0
23
- Requires-Dist: scikit-optimize>=0.8
23
+ Requires-Dist: bayesian-optimization>=1.4.3
24
24
  Requires-Dist: tqdm>=4.0
25
25
  Requires-Dist: black ; extra == "dev"
26
26
  Requires-Dist: flit ; extra == "dev"
@@ -35,7 +35,7 @@ dependencies = [
35
35
  "pennylane>=0.34.0",
36
36
  "scipy>=1.5",
37
37
  "scikit-learn>=1.0",
38
- "scikit-optimize>=0.8",
38
+ "bayesian-optimization>=1.4.3",
39
39
  "tqdm>=4.0",
40
40
  ]
41
41
  requires-python = ">=3.9"
@@ -3,7 +3,7 @@
3
3
  from .util import Executor
4
4
  from . import observables, encoding_circuit, kernel, optimizers, qnn, util
5
5
 
6
- __version__ = "0.7.3"
6
+ __version__ = "0.7.4"
7
7
 
8
8
  __all__ = [
9
9
  "Executor",
@@ -1,7 +1,6 @@
1
1
  from collections import deque
2
2
  import numpy as np
3
- from skopt import gp_minimize
4
- from scipy.optimize import minimize
3
+ from bayes_opt import BayesianOptimization, UtilityFunction
5
4
 
6
5
  from .approximated_gradients import FiniteDiffGradient
7
6
  from .optimizer_base import OptimizerBase, SGDMixin, default_callback, OptimizerResult
@@ -19,13 +18,9 @@ class SGLBO(OptimizerBase, SGDMixin):
19
18
  * **num_average** (int): Number of gradients to average (default: 1)
20
19
  * **bo_n_calls** (int): Number of iterations for the Bayesian Optimization (default: 20)
21
20
  * **bo_bounds** (List): Lower and upper bound for the search space for the Bayesian Optimization for each dimension. Each bound should be provided as a tupel (default: (0.0, 0.3))
22
- * **bo_bounds_fac** (float): Factor to adapt the bounds based on the gradient information (default: None)
23
21
  * **bo_n_initial_points** (int): Number of initial points for the Bayesian Optimization (default: 10)
24
- * **bo_x0_points** (list of lists): Initial input points (default: None)
25
- * **bo_aqc_optimizer** (str): Method to minimize the acquisition function. "sampling" or "lbfgs" (default: "lbfgs")
26
- * **bo_acq_func** (str): Acquisition function for the Bayesian Optimization (default: "EI"). Valid values are: "LCB", "EI", "PI", "gp_hedge"
27
- * **bo_noise** (float): Noise for noisy observations (default: "gaussian")
28
- * **min_surrogate** (bool): If True, the surrogate model is minimized to find the optimal step size (default: False)
22
+ * **bo_acq_func** (str): Acquisition function for the Bayesian Optimization (default: "ei"). Valid values are: "ucb", "ei", "poi"
23
+ * **bo_xi** (float): Exploration-exploitation trade-off parameter for the Bayesian Optimization (default: 0.01)
29
24
  * **log_file** (str): File to log the optimization (default: None)
30
25
 
31
26
  Args:
@@ -44,15 +39,11 @@ class SGLBO(OptimizerBase, SGDMixin):
44
39
  self.maxiter_total = options.get("maxiter_total", self.maxiter)
45
40
  self.eps = options.get("eps", 0.01)
46
41
  self.bo_n_calls = options.get("bo_n_calls", 20)
47
- self.bo_bounds = options.get("bo_bounds", [(0.0, 0.3)])
48
- self.bo_aqc_func = options.get("bo_aqc_func", "EI")
49
- self.bo_aqc_optimizer = options.get("bo_aqc_optimizer", "lbfgs")
42
+ self.bo_bounds = options.get("bo_bounds", (0.0, 0.3))
43
+ self.bo_aqc_func = options.get("bo_aqc_func", "ei")
44
+ self.bo_xi = options.get("bo_xi", 0.01)
50
45
  self.bo_n_initial_points = options.get("bo_n_initial_points", 10)
51
- self.bo_x0_points = options.get("bo_x0_points")
52
- self.bo_noise = options.get("bo_noise", "gaussian")
53
- self.bo_bounds_fac = options.get("bo_bounds_fac", None)
54
46
  self.log_file = options.get("log_file", None)
55
- self.min_surrogate = options.get("min_surrogate", False)
56
47
  self.num_average = options.get("num_average", 1)
57
48
 
58
49
  self.callback = callback
@@ -68,9 +59,7 @@ class SGLBO(OptimizerBase, SGDMixin):
68
59
  f"bo_n_calls: {self.bo_n_calls}\n"
69
60
  f"bo_bounds: {self.bo_bounds}\n"
70
61
  f"bo_aqc_func: {self.bo_aqc_func}\n"
71
- f"bo_aqc_optimizer: {self.bo_aqc_optimizer}\n"
72
62
  f"bo_n_initial_points: {self.bo_n_initial_points}\n"
73
- f"bo_x0_points: {self.bo_x0_points}\n"
74
63
  )
75
64
  output = " %9s %13s %13s %13s \n" % ("Iteration", "f(x)", "Gradient", "Step")
76
65
  f.write(header)
@@ -116,16 +105,6 @@ class SGLBO(OptimizerBase, SGDMixin):
116
105
  self.gradient_deque.append(grad(self.x))
117
106
  gradient = np.average(self.gradient_deque, axis=0)
118
107
 
119
- # adapt bounds and x0 based on the gradient
120
- if (
121
- self.bo_bounds is not None
122
- and self.bo_x0_points is not None
123
- and self.bo_bounds_fac is not None
124
- ):
125
- self.bo_bounds, self.bo_x0_points = self.__adapt_bounds(
126
- self.bo_bounds, self.bo_x0_points, gradient
127
- )
128
-
129
108
  x_updated = self.step(x=self.x, grad=gradient)
130
109
 
131
110
  # check termination
@@ -178,72 +157,34 @@ class SGLBO(OptimizerBase, SGDMixin):
178
157
 
179
158
  return func(updated_point)
180
159
 
181
- # bayesian optimization to estimate the step size in one dimension
182
- res = gp_minimize(
183
- step_size_cost,
184
- self.bo_bounds,
185
- n_calls=self.bo_n_calls,
186
- acq_func=self.bo_aqc_func,
187
- acq_optimizer=self.bo_aqc_optimizer,
188
- x0=self.bo_x0_points,
189
- n_jobs=-1,
190
- random_state=0,
191
- noise=self.bo_noise,
192
- n_initial_points=self.bo_n_initial_points,
193
- )
194
-
195
- # minimize the surrogate model to find the optimal step size
196
- if self.min_surrogate:
197
-
198
- def func_surrogate(x):
199
- reg = res.models[-1]
200
- x = res.space.transform(x.reshape(1, -1))
201
- return reg.predict(x.reshape(1, -1))[0]
202
-
203
- res_surr = minimize(
204
- func_surrogate, x0=res.x[0], method="Nelder-Mead", tol=1e-6, bounds=self.bo_bounds
205
- )
206
- x_val = res_surr.x
207
- else:
208
- x_val = res.x
209
-
210
- return x_val
211
-
212
- def __adapt_bounds(
213
- self, current_bounds: list, current_x0: list, gradient: np.ndarray
214
- ) -> tuple:
215
- """
216
- Function to adapt the bounds and initial points for gp_minimize based on the gradient information.
160
+ # Convert the minimization problem into a maximization problem
161
+ def neg_step_size_cost(x):
162
+ return -step_size_cost(x)
217
163
 
218
- Args:
219
- current_bounds (List): Current bounds for the search space.
220
- current_x0 (List): Current initial points.
221
- gradient (np.ndarray): Gradient of the objective function.
164
+ # Define the bounds for Bayesian Optimization
165
+ pbounds = {"x": self.bo_bounds}
222
166
 
223
- Returns:
224
- Tuple: Updated bounds for the search space and initial points.
225
- """
167
+ acquisition_function = UtilityFunction(kind=self.bo_aqc_func, xi=self.bo_xi)
226
168
 
227
- # Compute the magnitude of the gradient
228
- grad_magnitude = np.linalg.norm(gradient)
229
-
230
- # Update the bounds based on the gradient magnitude
231
- updated_bounds = []
232
- for bound in current_bounds:
233
- lower = max(bound[0] - self.bo_bounds_fac * grad_magnitude, 0.0)
234
- upper = bound[1] + self.bo_bounds_fac * grad_magnitude
235
- updated_bounds.append((lower, upper))
169
+ # Initialize Bayesian Optimization
170
+ bo = BayesianOptimization(
171
+ f=neg_step_size_cost,
172
+ pbounds=pbounds,
173
+ verbose=0,
174
+ random_state=0,
175
+ allow_duplicate_points=True,
176
+ )
236
177
 
237
- # Update the initial points based on the updated bounds and maintaining distribution
238
- updated_x0 = []
178
+ # Perform the optimization
179
+ bo.maximize(
180
+ init_points=self.bo_n_initial_points,
181
+ n_iter=self.bo_n_calls,
182
+ acquisition_function=acquisition_function,
183
+ )
239
184
 
240
- # Distribute the x0 points evenly within the updated bounds
241
- for i in range(len(current_x0)):
242
- t = i / len(current_x0) # t goes from 0 to 1
243
- updated_x0_point = [lower + t * (upper - lower) for (lower, upper) in updated_bounds]
244
- updated_x0.append(updated_x0_point)
185
+ x_val = bo.max["params"]["x"]
245
186
 
246
- return updated_bounds, updated_x0
187
+ return x_val
247
188
 
248
189
  def _log(self, fval, gradient, dx):
249
190
  """Function for creating a log entry of the optimization."""
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes