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.
- {squlearn-0.7.3 → squlearn-0.7.4}/CITATION.cff +2 -1
- {squlearn-0.7.3 → squlearn-0.7.4}/PKG-INFO +2 -2
- {squlearn-0.7.3 → squlearn-0.7.4}/pyproject.toml +1 -1
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/__init__.py +1 -1
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/sglbo.py +28 -87
- {squlearn-0.7.3 → squlearn-0.7.4}/.github/CODE_OF_CONDUCT.md +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/.github/CONTRIBUTING.md +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/.github/workflows/doc_checks.yml +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/.github/workflows/format.yml +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/.github/workflows/publish.yml +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/.github/workflows/publish_docs.yml +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/.github/workflows/tests.yaml +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/.gitignore +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/LICENSE.txt +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/README.md +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/Makefile +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/README.md +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/css/custom.css +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/favicon.png +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/logo.png +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/qnn/qnn.svg +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/schematic.png +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/_static/util/executor.png +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/_templates/class.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/_templates/class_with_call.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/_templates/function.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/conf.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/examples/example_kernel_digit_classification.nblink +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/examples/example_kernel_grid_search.nblink +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/examples/example_qnn_backend_mitigation.nblink +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/examples/example_quantum_bayesian_optimization.nblink +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/examples/examples_index.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/index.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/install/install.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/make.bat +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/modules/classes.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/qiskit_settings.conf +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/requirements.txt +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/spelling_wordlist.txt +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/encoding_circuits.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/executor.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/kernel_methods.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/observables.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/quantum_neural_networks.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/docs/user_guide/user_guide_index.rst +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/encoding_circuits/layered_encoding_circuit.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/encoding_circuits/pruning_example.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/encoding_circuits/various_encoding_circuit.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/executor/example_executor_qiskit.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/integration/mlflow.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/example_fidelity_kernel.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/example_projected_kernel.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/example_regularization_mitigation.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/qgpc_workflow.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/qgpr_optimization_workflow.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/kernel/qgpr_workflow.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/classification_example.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/example_adam.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/example_minibatch.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/example_qcnn_encoding_circuit.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/regression_example.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/qnn/regression_with_variance.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/images/encoding_circuit.png +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/images/pipeline.png +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/images/projected_quantum_kernel.png +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/images/quantum_bo.png +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/kernel_digit_classification.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/kernel_grid_search.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/kernel_regression.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/qnn_backend_mitigation.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/examples/tutorials/quantum_bayesian_optimization.ipynb +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/chebyshev_pqc.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/chebyshev_rx.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/chebyshev_tower.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/highdim_encoding_circuit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/hubregtsen_encoding_circuit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/multi_control_encoding_circuit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/param_z_feature_map.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/qcnn_encoding_circuit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/qiskit_encoding_circuit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/yz_cx_encoding_circuit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/encoding_circuit_base.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/encoding_circuit_derivatives.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/layered_encoding_circuit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/pruned_encoding_circuit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/transpiled_encoding_circuit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/fidelity_kernel.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/fidelity_kernel_pennylane.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/kernel_matrix_base.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/kernel_util.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/projected_quantum_kernel.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/matrix/regularization.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/qgpc.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/qgpr.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/qkrr.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/qsvc.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/ml/qsvr.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/kernel_loss_base.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/kernel_optimization_base.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/kernel_optimizer.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/negative_log_likelihood.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/target_alignment.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_base.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_derivatives.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/custom_observable.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/ising_hamiltonian.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/single_pauli.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/single_probability.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/summed_paulis.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/summed_probabilities.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/adam.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/approximated_gradients.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/optimizer_base.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/optimizers/optimizers_wrapper.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/barren_plateau_analysis.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/base_qnn.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/loss.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/lowlevel_qnn.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/lowlevel_qnn_base.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/lowlevel_qnn_pennylane.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/lowlevel_qnn_qiskit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/qnnc.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/qnnr.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/qnn/training.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/data_preprocessing.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/executor.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/optree/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/optree/optree.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/optree/optree_derivative.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/optree/optree_evaluate.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/pennylane/__init__.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/pennylane/pennylane_circuit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/pennylane/pennylane_gates.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/util/qfi.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/encoding_circuit/test_layered_encoding_circuit.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/kernel/ml/test_qgpc.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/kernel/ml/test_qgpr.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/kernel/ml/test_qkrr.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/kernel/ml/test_qsvc.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/kernel/ml/test_qsvr.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/optimizers/test_sglbo.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/qnn/test_base_qnn.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/qnn/test_qnnc.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/qnn/test_qnnr.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/qnn/test_training.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/util/optree/test_optree_derivative.py +0 -0
- {squlearn-0.7.3 → squlearn-0.7.4}/tests/util/optree/test_optree_evaluate.py +0 -0
- {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
|
+
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:
|
|
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"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from collections import deque
|
|
2
2
|
import numpy as np
|
|
3
|
-
from
|
|
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
|
-
* **
|
|
25
|
-
* **
|
|
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",
|
|
48
|
-
self.bo_aqc_func = options.get("bo_aqc_func", "
|
|
49
|
-
self.
|
|
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
|
-
#
|
|
182
|
-
|
|
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
|
-
|
|
219
|
-
|
|
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
|
-
|
|
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
|
-
#
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
-
#
|
|
238
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{squlearn-0.7.3 → squlearn-0.7.4}/docs/examples/example_quantum_bayesian_optimization.nblink
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/chebyshev_pqc.py
RENAMED
|
File without changes
|
{squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/chebyshev_rx.py
RENAMED
|
File without changes
|
{squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/circuit_library/chebyshev_tower.py
RENAMED
|
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
|
{squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/encoding_circuit_derivatives.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/encoding_circuit/transpiled_encoding_circuit.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/kernel_optimization_base.py
RENAMED
|
File without changes
|
|
File without changes
|
{squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/kernel/optimization/negative_log_likelihood.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/single_pauli.py
RENAMED
|
File without changes
|
|
File without changes
|
{squlearn-0.7.3 → squlearn-0.7.4}/src/squlearn/observables/observable_implemented/summed_paulis.py
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|