squlearn 0.6.0__tar.gz → 0.7.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.
- {squlearn-0.6.0 → squlearn-0.7.0}/.gitignore +4 -4
- {squlearn-0.6.0 → squlearn-0.7.0}/PKG-INFO +3 -2
- {squlearn-0.6.0 → squlearn-0.7.0}/README.md +1 -1
- squlearn-0.7.0/docs/_static/schematic.png +0 -0
- squlearn-0.7.0/docs/_static/util/executor.png +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/modules/classes.rst +18 -2
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/user_guide/executor.rst +95 -39
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/user_guide/kernel_methods.rst +3 -3
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/user_guide/quantum_neural_networks.rst +1 -1
- squlearn-0.6.0/examples/executor/example_executor.ipynb → squlearn-0.7.0/examples/executor/example_executor_qiskit.ipynb +20 -20
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/integration/mlflow.ipynb +8 -8
- squlearn-0.7.0/examples/kernel/example_fidelity_kernel.ipynb +189 -0
- squlearn-0.7.0/examples/kernel/example_projected_kernel.ipynb +697 -0
- squlearn-0.7.0/examples/kernel/example_regularization_mitigation.ipynb +387 -0
- squlearn-0.7.0/examples/kernel/qgpc_workflow.ipynb +579 -0
- squlearn-0.7.0/examples/kernel/qgpr_optimization_workflow.ipynb +196 -0
- squlearn-0.7.0/examples/kernel/qgpr_workflow.ipynb +181 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/qnn/classification_example.ipynb +14 -6
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/qnn/example_adam.ipynb +28 -12
- squlearn-0.7.0/examples/qnn/example_minibatch.ipynb +312 -0
- squlearn-0.7.0/examples/qnn/example_qcnn_encoding_circuit.ipynb +549 -0
- squlearn-0.7.0/examples/qnn/regression_example.ipynb +385 -0
- squlearn-0.7.0/examples/qnn/regression_with_variance.ipynb +396 -0
- squlearn-0.7.0/examples/tutorials/kernel_digit_classification.ipynb +1061 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/tutorials/kernel_grid_search.ipynb +424 -36
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/tutorials/kernel_regression.ipynb +10 -7
- squlearn-0.7.0/examples/tutorials/quantum_bayesian_optimization.ipynb +533 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/pyproject.toml +1 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/__init__.py +1 -1
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/__init__.py +2 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/circuit_library/highdim_encoding_circuit.py +17 -15
- squlearn-0.7.0/src/squlearn/encoding_circuit/circuit_library/qcnn_encoding_circuit.py +709 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/layered_encoding_circuit.py +6 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/matrix/fidelity_kernel.py +90 -35
- squlearn-0.7.0/src/squlearn/kernel/matrix/fidelity_kernel_pennylane.py +310 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/matrix/projected_quantum_kernel.py +19 -12
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/ml/qgpc.py +1 -1
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/ml/qgpr.py +1 -1
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/ml/qkrr.py +1 -1
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/ml/qsvc.py +1 -1
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/ml/qsvr.py +1 -1
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/optimization/kernel_optimizer.py +1 -1
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/observables/observable_base.py +2 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/observables/observable_derivatives.py +2 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/observables/observable_implemented/custom_observable.py +2 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/observables/observable_implemented/ising_hamiltonian.py +2 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/observables/observable_implemented/single_pauli.py +2 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/observables/observable_implemented/single_probability.py +3 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/observables/observable_implemented/summed_paulis.py +2 -3
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/observables/observable_implemented/summed_probabilities.py +2 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/qnn/barren_plateau_analysis.py +6 -3
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/qnn/base_qnn.py +60 -7
- squlearn-0.7.0/src/squlearn/qnn/lowlevel_qnn.py +45 -0
- squlearn-0.7.0/src/squlearn/qnn/lowlevel_qnn_base.py +156 -0
- squlearn-0.7.0/src/squlearn/qnn/lowlevel_qnn_pennylane.py +987 -0
- squlearn-0.6.0/src/squlearn/qnn/qnn.py → squlearn-0.7.0/src/squlearn/qnn/lowlevel_qnn_qiskit.py +116 -78
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/qnn/qnnc.py +5 -3
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/qnn/qnnr.py +4 -2
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/qnn/training.py +5 -5
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/util/data_preprocessing.py +46 -1
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/util/executor.py +550 -112
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/util/optree/optree_evaluate.py +83 -9
- squlearn-0.7.0/src/squlearn/util/pennylane/__init__.py +4 -0
- squlearn-0.7.0/src/squlearn/util/pennylane/pennylane_circuit.py +583 -0
- squlearn-0.7.0/src/squlearn/util/pennylane/pennylane_gates.py +93 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/encoding_circuit/test_layered_encoding_circuit.py +11 -15
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/kernel/ml/test_qgpc.py +2 -2
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/kernel/ml/test_qgpr.py +2 -2
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/kernel/ml/test_qkrr.py +2 -2
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/kernel/ml/test_qsvc.py +2 -2
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/kernel/ml/test_qsvr.py +2 -2
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/qnn/test_base_qnn.py +8 -8
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/qnn/test_qnnc.py +2 -2
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/qnn/test_qnnr.py +2 -2
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/qnn/test_training.py +5 -5
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/util/test_executor.py +76 -6
- squlearn-0.6.0/docs/_static/schematic.png +0 -0
- squlearn-0.6.0/docs/_static/util/executor.png +0 -0
- squlearn-0.6.0/examples/kernel/example_fidelity_kernel.ipynb +0 -191
- squlearn-0.6.0/examples/kernel/example_projected_kernel.ipynb +0 -280
- squlearn-0.6.0/examples/kernel/example_regularization_mitigation.ipynb +0 -469
- squlearn-0.6.0/examples/kernel/qgpc_workflow.ipynb +0 -168
- squlearn-0.6.0/examples/kernel/qgpr_optimization_workflow.ipynb +0 -198
- squlearn-0.6.0/examples/kernel/qgpr_workflow.ipynb +0 -181
- squlearn-0.6.0/examples/qnn/example_minibatch.ipynb +0 -311
- squlearn-0.6.0/examples/qnn/regression_example.ipynb +0 -378
- squlearn-0.6.0/examples/qnn/regression_with_variance.ipynb +0 -399
- squlearn-0.6.0/examples/tutorials/kernel_digit_classification.ipynb +0 -663
- squlearn-0.6.0/examples/tutorials/quantum_bayesian_optimization.ipynb +0 -535
- {squlearn-0.6.0 → squlearn-0.7.0}/.github/CODE_OF_CONDUCT.md +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/.github/CONTRIBUTING.md +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/.github/workflows/doc_checks.yml +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/.github/workflows/format.yml +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/.github/workflows/publish.yml +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/.github/workflows/publish_docs.yml +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/.github/workflows/tests.yaml +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/CITATION.cff +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/LICENSE.txt +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/Makefile +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/README.md +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/_static/css/custom.css +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/_static/favicon.png +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/_static/logo.png +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/_static/qnn/qnn.svg +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/_templates/class.rst +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/_templates/class_with_call.rst +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/_templates/function.rst +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/conf.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/examples/example_kernel_digit_classification.nblink +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/examples/example_kernel_grid_search.nblink +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/examples/example_qnn_backend_mitigation.nblink +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/examples/example_quantum_bayesian_optimization.nblink +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/examples/examples_index.rst +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/index.rst +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/install/install.rst +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/make.bat +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/qiskit_settings.conf +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/requirements.txt +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/spelling_wordlist.txt +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/user_guide/encoding_circuits.rst +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/user_guide/observables.rst +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/docs/user_guide/user_guide_index.rst +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/encoding_circuits/layered_encoding_circuit.ipynb +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/encoding_circuits/pruning_example.ipynb +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/encoding_circuits/various_encoding_circuit.ipynb +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/tutorials/images/encoding_circuit.png +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/tutorials/images/pipeline.png +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/tutorials/images/projected_quantum_kernel.png +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/tutorials/images/quantum_bo.png +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/examples/tutorials/qnn_backend_mitigation.ipynb +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/circuit_library/__init__.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/circuit_library/chebyshev_pqc.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/circuit_library/chebyshev_rx.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/circuit_library/chebyshev_tower.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/circuit_library/hubregtsen_encoding_circuit.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/circuit_library/multi_control_encoding_circuit.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/circuit_library/param_z_feature_map.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/circuit_library/qiskit_encoding_circuit.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/circuit_library/yz_cx_encoding_circuit.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/encoding_circuit_base.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/encoding_circuit_derivatives.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/pruned_encoding_circuit.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/encoding_circuit/transpiled_encoding_circuit.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/__init__.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/matrix/__init__.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/matrix/kernel_matrix_base.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/matrix/kernel_util.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/matrix/regularization.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/ml/__init__.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/optimization/__init__.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/optimization/kernel_loss_base.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/optimization/kernel_optimization_base.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/optimization/negative_log_likelihood.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/kernel/optimization/target_alignment.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/observables/__init__.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/observables/observable_implemented/__init__.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/optimizers/__init__.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/optimizers/adam.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/optimizers/approximated_gradients.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/optimizers/optimizer_base.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/optimizers/optimizers_wrapper.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/qnn/__init__.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/qnn/loss.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/util/__init__.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/util/optree/__init__.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/util/optree/optree.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/util/optree/optree_derivative.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/src/squlearn/util/qfi.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/util/optree/test_optree_derivative.py +0 -0
- {squlearn-0.6.0 → squlearn-0.7.0}/tests/util/optree/test_optree_evaluate.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: squlearn
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
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>, Frederic Rapp <frederic.rapp@ipa.fraunhofer.de>, Marco Roth <marco.roth@ipa.fraunhofer.de>, Jan Schnabel <jan.schnabel@ipa.fraunhofer.de>, Moritz Willmann <moritz.willmann@ipa.fraunhofer.de>
|
|
@@ -17,6 +17,7 @@ Requires-Dist: qiskit-aer>=0.12.0
|
|
|
17
17
|
Requires-Dist: qiskit-algorithms>=0.3.0
|
|
18
18
|
Requires-Dist: qiskit-ibm-runtime>=0.15.1
|
|
19
19
|
Requires-Dist: qiskit-machine-learning>=0.6.1
|
|
20
|
+
Requires-Dist: pennylane>=0.34.0
|
|
20
21
|
Requires-Dist: scipy>=1.5
|
|
21
22
|
Requires-Dist: scikit-learn>=1.0
|
|
22
23
|
Requires-Dist: tqdm>=4.0
|
|
@@ -49,7 +50,7 @@ Provides-Extra: examples
|
|
|
49
50
|
|
|
50
51
|
sQUlearn is a user-friendly, NISQ-ready Python library for quantum machine learning (QML), designed for seamless integration with classical machine learning tools like scikit-learn. The library's dual-layer architecture serves both QML researchers and practitioners, enabling efficient prototyping, experimentation, and pipelining. sQUlearn provides a comprehensive toolset that includes both quantum kernel methods and quantum neural networks, along with features like customizable data encoding strategies, automated execution handling, and specialized kernel regularization techniques. By focusing on NISQ-compatibility and end-to-end automation, sQUlearn aims to bridge the gap between current quantum computing capabilities and practical machine learning applications.
|
|
51
52
|
|
|
52
|
-
sQUlearn offers scikit-learn compatible high-level interfaces for various kernel methods and QNNs. They build on top of the low-level interfaces of the QNN engine and the quantum kernel engine. The executor is used to run experiments on simulated and real backends
|
|
53
|
+
sQUlearn offers scikit-learn compatible high-level interfaces for various kernel methods and QNNs. They build on top of the low-level interfaces of the QNN engine and the quantum kernel engine. The executor is used to run experiments on simulated and real backends of the Qiskit or PennyLane frameworks.
|
|
53
54
|
|
|
54
55
|
<p align="center">
|
|
55
56
|
<img width=500px alt="sQUlearn schematic" src="https://raw.githubusercontent.com/sQUlearn/squlearn/main/docs/_static/schematic.png" />
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
sQUlearn is a user-friendly, NISQ-ready Python library for quantum machine learning (QML), designed for seamless integration with classical machine learning tools like scikit-learn. The library's dual-layer architecture serves both QML researchers and practitioners, enabling efficient prototyping, experimentation, and pipelining. sQUlearn provides a comprehensive toolset that includes both quantum kernel methods and quantum neural networks, along with features like customizable data encoding strategies, automated execution handling, and specialized kernel regularization techniques. By focusing on NISQ-compatibility and end-to-end automation, sQUlearn aims to bridge the gap between current quantum computing capabilities and practical machine learning applications.
|
|
6
6
|
|
|
7
|
-
sQUlearn offers scikit-learn compatible high-level interfaces for various kernel methods and QNNs. They build on top of the low-level interfaces of the QNN engine and the quantum kernel engine. The executor is used to run experiments on simulated and real backends
|
|
7
|
+
sQUlearn offers scikit-learn compatible high-level interfaces for various kernel methods and QNNs. They build on top of the low-level interfaces of the QNN engine and the quantum kernel engine. The executor is used to run experiments on simulated and real backends of the Qiskit or PennyLane frameworks.
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
<img width=500px alt="sQUlearn schematic" src="https://raw.githubusercontent.com/sQUlearn/squlearn/main/docs/_static/schematic.png" />
|
|
Binary file
|
|
Binary file
|
|
@@ -65,6 +65,7 @@ Encoding Circuits
|
|
|
65
65
|
encoding_circuit.ChebyshevRx
|
|
66
66
|
encoding_circuit.ParamZFeatureMap
|
|
67
67
|
encoding_circuit.QiskitEncodingCircuit
|
|
68
|
+
encoding_circuit.QCNNEncodingCircuit
|
|
68
69
|
|
|
69
70
|
Encoding Circuit Tools
|
|
70
71
|
------------------------------------
|
|
@@ -190,8 +191,11 @@ QNN Core
|
|
|
190
191
|
:toctree: generated/
|
|
191
192
|
:template: class.rst
|
|
192
193
|
|
|
193
|
-
qnn.
|
|
194
|
-
qnn.
|
|
194
|
+
qnn.lowlevel_qnn.LowLevelQNN
|
|
195
|
+
qnn.lowlevel_qnn_qiskit.LowLevelQNNQiskit
|
|
196
|
+
qnn.lowlevel_qnn_qiskit.Expec
|
|
197
|
+
qnn.lowlevel_qnn_pennylane.LowLevelQNNPennyLane
|
|
198
|
+
qnn.lowlevel_qnn_base.LowLevelQNNBase
|
|
195
199
|
qnn.loss.SquaredLoss
|
|
196
200
|
qnn.loss.VarianceLoss
|
|
197
201
|
qnn.loss.ParameterRegularizationLoss
|
|
@@ -249,6 +253,18 @@ OpTree Data Structure
|
|
|
249
253
|
util.optree.OpTreeContainer
|
|
250
254
|
util.optree.OpTreeValue
|
|
251
255
|
|
|
256
|
+
PennyLane interface
|
|
257
|
+
------------------------------------
|
|
258
|
+
|
|
259
|
+
.. currentmodule:: squlearn
|
|
260
|
+
|
|
261
|
+
.. autosummary::
|
|
262
|
+
:nosignatures:
|
|
263
|
+
:toctree: generated/
|
|
264
|
+
:template: class.rst
|
|
265
|
+
|
|
266
|
+
util.pennylane.PennyLaneCircuit
|
|
267
|
+
|
|
252
268
|
|
|
253
269
|
Base Classes
|
|
254
270
|
------------------------------------
|
|
@@ -11,13 +11,12 @@ Overview
|
|
|
11
11
|
|
|
12
12
|
The :class:`Executor <squlearn.Executor>` class is the central component of sQUlearn, responsible
|
|
13
13
|
for running all quantum jobs.
|
|
14
|
-
Both high- and low-level methods utilize the Executor class to execute circuits or other
|
|
14
|
+
Both high- and low-level methods utilize the Executor class to execute circuits or to run other
|
|
15
15
|
quantum jobs.
|
|
16
|
-
The class provides a high-level interface to the
|
|
17
|
-
Quantum
|
|
18
|
-
It features a variety of comfort features, such as
|
|
19
|
-
restarts
|
|
20
|
-
required in the sub-program.
|
|
16
|
+
The class provides a high-level interface to the simulators of PennyLane and Qiskit,
|
|
17
|
+
as well as manages access to real QC hardware as for example IBM Quantum.
|
|
18
|
+
It features a variety of comfort features, such as result caching,
|
|
19
|
+
automatic restarts of failed jobs, logging of all actions, and Qiskit Session handling.
|
|
21
20
|
The Executor class is also responsible for handling the execution environment, and can be
|
|
22
21
|
initialized with a variety of objects that specify the execution environment (see figure below).
|
|
23
22
|
The following figure summarizes the structure of the Executor class; ingoing arrows indicate
|
|
@@ -33,13 +32,11 @@ Key Features of the Executor
|
|
|
33
32
|
|
|
34
33
|
The Executor class provides the following key comfort features when executing a quantum job:
|
|
35
34
|
|
|
36
|
-
- **Session handling:** Automatically manages the creation and handling of Qiskit sessions.
|
|
37
|
-
If Sessions are time out, the Executor automatically creates a new session and re-executes the
|
|
38
|
-
job.
|
|
39
35
|
- **Result caching:** Enables caching of results to avoid redundant job executions, and enable
|
|
40
|
-
restarts of failed executions. Caching is enabled as default
|
|
36
|
+
restarts of failed executions. Caching is enabled as default for remote executions, but can also
|
|
37
|
+
be manually activated for local execution.
|
|
41
38
|
The cached files are named after the hash out of different properties of the quantum job,
|
|
42
|
-
that include the backend name, the circuit, the options
|
|
39
|
+
that include the backend name, the circuit, the execution options, etc.
|
|
43
40
|
Before running a job, the Executor checks if a cached result exists and returns it if it does.
|
|
44
41
|
The caching can be disabled by setting the ``caching`` argument to ``False``; the folder for
|
|
45
42
|
the cached results can be specified by the ``cache_dir`` argument,
|
|
@@ -50,46 +47,99 @@ The Executor class provides the following key comfort features when executing a
|
|
|
50
47
|
between restarts can be adjusted by the ``wait_restart`` argument.
|
|
51
48
|
- **Logging:** The executor automatically logs all actions to a log file that ca be specified
|
|
52
49
|
via the ``log_file`` argument.
|
|
50
|
+
- **Random Seeds for shot-based simulators:** A random seeds can be specified for the PennyLane
|
|
51
|
+
and Qiskit shot-based simulators to make the computations utilizing this Executor object
|
|
52
|
+
reproducible. The random seeds can be set manually by specifying the ``seed`` argument.
|
|
53
53
|
- **Modified Qiskit Primitives:** The Executor allows the creation of modified Qiskit Primitives
|
|
54
|
-
that function
|
|
54
|
+
that function exactly as the Qiskit primitives but leverage the comfort features mentioned above.
|
|
55
55
|
The primitives can be obtained utilizing the :meth:`get_estimator` and
|
|
56
56
|
:meth:`get_sampler` methods. The modified primitives route all executions through the Executor
|
|
57
57
|
class, and thus benefit from all comfort features. The primitives are fully compatible with
|
|
58
58
|
the Qiskit framework, and can be used in the same way as regular primitives.
|
|
59
59
|
The Executor primitives are automatically utilized in the sQUlearn
|
|
60
60
|
sub-programs.
|
|
61
|
+
- **Qiskit Session handling:** Automatically manages the creation and handling of Qiskit sessions.
|
|
62
|
+
If Sessions are time out, the Executor automatically creates a new session and re-executes the
|
|
63
|
+
job.
|
|
61
64
|
|
|
62
65
|
Initialization of the Executor class
|
|
63
66
|
------------------------------------
|
|
64
67
|
|
|
65
|
-
The Estimator can be initialized with various inputs (``execution=``) that specify the
|
|
68
|
+
The Estimator can be initialized with various inputs (``execution=``) that specify the
|
|
66
69
|
execution environment:
|
|
67
70
|
|
|
68
|
-
-
|
|
69
|
-
|
|
71
|
+
- Default initialization with no backend specified: If no backend is specified, the Executor
|
|
72
|
+
class is initialized utilizing the fast PennyLane simulators.
|
|
73
|
+
If no shots are specified (``shots=None``) the statevector simulator being utilized,
|
|
74
|
+
which is the default. If shots are specified, the shot-based simulator is utilized.
|
|
70
75
|
|
|
71
|
-
..
|
|
76
|
+
.. jupyter-execute::
|
|
72
77
|
|
|
73
78
|
from squlearn import Executor
|
|
74
|
-
|
|
79
|
+
# Initialize the Executor with the PennyLane statevector simulator
|
|
80
|
+
# as default, shots=None (statevector simulator)
|
|
81
|
+
executor = Executor()
|
|
82
|
+
|
|
83
|
+
# Initialize the Executor with the PennyLane shot-based simulator
|
|
84
|
+
executor = Executor(shots=1234)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
- A string specifying the local simulator backend: Qiskit simulators are available by ``"qiskit"``,
|
|
88
|
+
``"statevector_simulator"`` and ``"qasm_simulator"``; PennyLane simulators can be initialized by
|
|
89
|
+
``"pennylane"`` or ``"default.qubit"``.
|
|
90
|
+
|
|
91
|
+
.. jupyter-execute::
|
|
92
|
+
|
|
93
|
+
from squlearn import Executor
|
|
94
|
+
# Initialize the Executor with the statevector simulator
|
|
95
|
+
executor = Executor("statevector_simulator")
|
|
75
96
|
|
|
76
|
-
|
|
77
|
-
|
|
97
|
+
# Initialize the Executor with the qasm simulator
|
|
98
|
+
executor = Executor("qasm_simulator", shots=1234)
|
|
99
|
+
|
|
100
|
+
# Initialize the Executor with qiksit is equivalent to "statevector_simulator"
|
|
101
|
+
executor = Executor("qiskit")
|
|
102
|
+
|
|
103
|
+
# Initialize the Executor with the PennyLane statevector simulator
|
|
104
|
+
executor = Executor("pennylane")
|
|
105
|
+
|
|
106
|
+
# Initialize the Executor with the PennyLane shot-based simulator
|
|
107
|
+
executor = Executor("default.qubit", shots=1234)
|
|
78
108
|
|
|
79
109
|
- A backend following the Qiskit backend standard, e.g. a Qiskit Aer backend, a fake backend,
|
|
80
|
-
a real IBM Quantum backend. This allows
|
|
81
|
-
of other quantum computing backends
|
|
110
|
+
a real IBM Quantum backend. This allows also the utilization
|
|
111
|
+
of other quantum computing backends, as long as they provide a Qiskit backend
|
|
82
112
|
class.
|
|
83
113
|
|
|
84
|
-
..
|
|
114
|
+
.. jupyter-execute::
|
|
85
115
|
|
|
86
116
|
from squlearn import Executor
|
|
87
117
|
from qiskit_aer import Aer
|
|
118
|
+
from qiskit_ibm_runtime.fake_provider import FakeManilaV2
|
|
88
119
|
|
|
120
|
+
# Executor with the Aer statevector simulator
|
|
89
121
|
executor = Executor(Aer.get_backend("aer_simulator"))
|
|
90
122
|
|
|
123
|
+
# Executor with the FakeManilaV2 backend
|
|
124
|
+
executor = Executor(FakeManilaV2())
|
|
125
|
+
|
|
126
|
+
- A PennyLane device of a quantum computing backend. In the following example, the Executor is
|
|
127
|
+
initialized with a AWS device. Note that this example requires the PennyLane AWS plugin to be
|
|
128
|
+
installed (``pip install amazon-braket-pennylane-plugin``) and the AWS credentials to be
|
|
129
|
+
configured.
|
|
130
|
+
|
|
131
|
+
.. code-block:: python
|
|
132
|
+
|
|
133
|
+
from squlearn import Executor
|
|
134
|
+
import pennylane as qml
|
|
135
|
+
|
|
136
|
+
# Initialize the Executor with the PennyLane default.qubit device
|
|
137
|
+
dev = qml.device("braket.aws.qubit", device_arn="arn:aws:braket:::device/quantum-simulator/amazon/sv1", wires=2)
|
|
138
|
+
executor = Executor(dev, shots = 1234)
|
|
139
|
+
|
|
140
|
+
|
|
91
141
|
- A backend from the Qiskit Runtime Service, which utilizes the execution of quantum jobs on
|
|
92
|
-
IBM Quantum
|
|
142
|
+
IBM Quantum. Sessions and Primitives are automatically created and managed by the Executor class.
|
|
93
143
|
|
|
94
144
|
.. code-block:: python
|
|
95
145
|
|
|
@@ -97,7 +147,7 @@ execution environment:
|
|
|
97
147
|
from qiskit_ibm_runtime import QiskitRuntimeService
|
|
98
148
|
|
|
99
149
|
service = QiskitRuntimeService(channel="ibm_quantum", token="INSERT_YOUR_TOKEN_HERE")
|
|
100
|
-
executor = Executor(service.get_backend('
|
|
150
|
+
executor = Executor(service.get_backend('ibm_kyoto'))
|
|
101
151
|
|
|
102
152
|
- A pre-initialized Session object, which can be used to execute quantum jobs on the Qiskit
|
|
103
153
|
Runtime Service
|
|
@@ -108,7 +158,7 @@ execution environment:
|
|
|
108
158
|
from qiskit_ibm_runtime import QiskitRuntimeService
|
|
109
159
|
|
|
110
160
|
service = QiskitRuntimeService(channel="ibm_quantum", token="INSERT_YOUR_TOKEN_HERE")
|
|
111
|
-
session = service.create_session()
|
|
161
|
+
session = service.create_session(backend = service.get_backend('ibm_kyoto'))
|
|
112
162
|
executor = Executor(session)
|
|
113
163
|
|
|
114
164
|
- Pre-configured Primitive with options for transpiling and error mitigation. The Executor class
|
|
@@ -128,12 +178,13 @@ execution environment:
|
|
|
128
178
|
options.optimization_level = 0 # No optimization in transpilation
|
|
129
179
|
options.resilience_level = 2 # ZNE
|
|
130
180
|
|
|
131
|
-
|
|
181
|
+
session = service.create_session(backend = service.get_backend('ibm_kyoto'))
|
|
182
|
+
estimator = Estimator(session=session, options_estimator=options)
|
|
132
183
|
executor = Executor(estimator)
|
|
133
184
|
|
|
134
185
|
- If only the ``backend.run`` execution is wanted, this can be achieved by utilizing the
|
|
135
|
-
Qiskit IBM Provider package. However, most sQUlearn algorithms a build upon primitives
|
|
136
|
-
|
|
186
|
+
Qiskit IBM Provider package. However, most sQUlearn algorithms a build upon primitives,
|
|
187
|
+
and therefore, this access is not recommended, since it is likely to be deprecated in the future.
|
|
137
188
|
|
|
138
189
|
.. code-block:: python
|
|
139
190
|
|
|
@@ -144,8 +195,8 @@ execution environment:
|
|
|
144
195
|
provider = IBMProvider(instance="hub/group/project")
|
|
145
196
|
executor = Executor(provider.get_backend("ibmq_qasm_simulator"))
|
|
146
197
|
|
|
147
|
-
|
|
148
|
-
and setting options for caching, logging and restarts:
|
|
198
|
+
The following code shows an example for configuring the Executor class with a
|
|
199
|
+
backend from the Qiskit Runtime Service and setting options for caching, logging and restarts:
|
|
149
200
|
|
|
150
201
|
.. code-block:: python
|
|
151
202
|
|
|
@@ -159,7 +210,7 @@ and setting options for caching, logging and restarts:
|
|
|
159
210
|
options.optimization_level = 0 # No optimization in transpilation
|
|
160
211
|
options.resilience_level = 2 # ZNE
|
|
161
212
|
|
|
162
|
-
|
|
213
|
+
executor = Executor(service.get_backend('ibm_kyoto'), # Specify the backend
|
|
163
214
|
cache_dir='cache' # Set cache folder to "cache"
|
|
164
215
|
caching=True, # Enable caching default for remote executions
|
|
165
216
|
log_file="executor.log", # Set-up logging file
|
|
@@ -168,14 +219,18 @@ and setting options for caching, logging and restarts:
|
|
|
168
219
|
options_estimator=options # Set options for the Estimator primitive
|
|
169
220
|
)
|
|
170
221
|
|
|
222
|
+
executor.set_shots(1234) # Shots an be adjusted after initialization
|
|
223
|
+
|
|
171
224
|
|
|
172
225
|
Utilizing Executor Primitives in Qiskit Routines
|
|
173
226
|
-------------------------------------------------
|
|
174
227
|
|
|
175
228
|
The Executor class provides an Estimator and Sampler primitive that are compatible with the
|
|
176
|
-
Qiskit framework.
|
|
177
|
-
|
|
178
|
-
|
|
229
|
+
Qiskit framework. This is only possible, in case the Executor class is initialized with a backend
|
|
230
|
+
compatible with Qiskit (and not PennyLane). The primitives can be obtained by the
|
|
231
|
+
:meth:`get_estimator` and :meth:`get_sampler` methods of the Executor class.
|
|
232
|
+
The primitives automatically utilized the parent Executor class for all executions,
|
|
233
|
+
and thus benefit from all comfort features of the Executor.
|
|
179
234
|
|
|
180
235
|
The following example shows, how to evaluate the Quantum Fisher Information utilizing the
|
|
181
236
|
Executor primitive (see `QFI in Qiskit <https://qiskit-community.github.io/qiskit-algorithms/stubs/qiskit_algorithms.gradients.QFI.html>`_)
|
|
@@ -185,7 +240,7 @@ Executor primitive (see `QFI in Qiskit <https://qiskit-community.github.io/qiski
|
|
|
185
240
|
from squlearn import Executor
|
|
186
241
|
from qiskit_algorithms.gradients import LinCombQGT, QFI
|
|
187
242
|
from qiskit.quantum_info import Pauli
|
|
188
|
-
# Executor
|
|
243
|
+
# Executor initialization (other ways are possible, see above)
|
|
189
244
|
executor = Executor(execution="statevector_simulator")
|
|
190
245
|
# This creates the QFI primitive that utilizes the Estimator of the Executor class
|
|
191
246
|
qfi = QFI(LinCombQGT(executor.get_estimator()))
|
|
@@ -199,8 +254,8 @@ not creating or referring to the Executor primitives! Instead they refer to the
|
|
|
199
254
|
Qiskit Primitives used internally that do not utilize any caching, restarts, etc.
|
|
200
255
|
|
|
201
256
|
|
|
202
|
-
Setting Options for Primitives
|
|
203
|
-
|
|
257
|
+
Setting Options for Qiskit Primitives
|
|
258
|
+
--------------------------------------
|
|
204
259
|
|
|
205
260
|
Options for the Primitives can be provided through the ``options_estimator`` and
|
|
206
261
|
``options_sampler`` arguments, but they are also automatically copied from inputted primitives.
|
|
@@ -217,7 +272,7 @@ Options for the Primitives can be provided through the ``options_estimator`` and
|
|
|
217
272
|
options.execution.shots = 5000
|
|
218
273
|
options.resilience_level = 0 # No Mitigation
|
|
219
274
|
|
|
220
|
-
executor = Executor(service.get_backend("
|
|
275
|
+
executor = Executor(service.get_backend("ibm_kyoto"),options_estimator=options)
|
|
221
276
|
|
|
222
277
|
Options can be adjusted by the :meth:`set_options` method of the Primitives that are created by the
|
|
223
278
|
Executor class.
|
|
@@ -229,7 +284,7 @@ Executor class.
|
|
|
229
284
|
|
|
230
285
|
service = QiskitRuntimeService(channel="ibm_quantum", token="INSERT_YOUR_TOKEN_HERE")
|
|
231
286
|
|
|
232
|
-
executor = Executor(service.get_backend("
|
|
287
|
+
executor = Executor(service.get_backend("ibm_kyoto"))
|
|
233
288
|
estimator = executor.get_estimator()
|
|
234
289
|
estimator.set_options(resilience_level=2)
|
|
235
290
|
|
|
@@ -238,3 +293,4 @@ Executor class.
|
|
|
238
293
|
* :class:`Executor <squlearn.Executor>`
|
|
239
294
|
* `Qiskit Runtime <https://quantum-computing.ibm.com/lab/docs/iql/runtime>`_
|
|
240
295
|
* `Qsikit Primitives <https://qiskit.org/documentation/apidoc/primitives.html>`_
|
|
296
|
+
* `PennyLane Devices <https://docs.pennylane.ai/en/stable/code/api/pennylane.device.html>`_
|
|
@@ -199,7 +199,7 @@ the following example:
|
|
|
199
199
|
enc_circ = ChebyshevPQC(num_qubits=4, num_features= 1, num_layers=2)
|
|
200
200
|
pqk_instance = ProjectedQuantumKernel(
|
|
201
201
|
encoding_circuit=enc_circ,
|
|
202
|
-
executor=Executor(
|
|
202
|
+
executor=Executor(),
|
|
203
203
|
measurement='XYZ',
|
|
204
204
|
outer_kernel='gaussian'
|
|
205
205
|
)
|
|
@@ -242,7 +242,7 @@ training and test data and shows how to optimize kernels.
|
|
|
242
242
|
enc_circ = ChebyshevPQC(num_qubits=4, num_features=1, num_layers=2)
|
|
243
243
|
pqk_instance = ProjectedQuantumKernel(
|
|
244
244
|
encoding_circuit=enc_circ,
|
|
245
|
-
executor=Executor(
|
|
245
|
+
executor=Executor(),
|
|
246
246
|
measurement='XYZ',
|
|
247
247
|
outer_kernel='gaussian',
|
|
248
248
|
parameter_seed=0
|
|
@@ -274,7 +274,7 @@ training and test data and shows how to optimize kernels.
|
|
|
274
274
|
enc_circ = ChebyshevPQC(num_qubits=4, num_features=1, num_layers=2)
|
|
275
275
|
pqk_instance = ProjectedQuantumKernel(
|
|
276
276
|
encoding_circuit=enc_circ,
|
|
277
|
-
executor=Executor(
|
|
277
|
+
executor=Executor(),
|
|
278
278
|
measurement='XYZ',
|
|
279
279
|
outer_kernel='gaussian',
|
|
280
280
|
parameter_seed=0
|
|
@@ -137,7 +137,7 @@ and the Adam optimizer for optimization.
|
|
|
137
137
|
|
|
138
138
|
op = SummedPaulis(num_qubits = 4)
|
|
139
139
|
pqc = ChebyshevPQC(num_qubits = 4, num_features = 1, num_layers = 2)
|
|
140
|
-
qnn = QNNRegressor(pqc, op, Executor(
|
|
140
|
+
qnn = QNNRegressor(pqc, op, Executor(), SquaredLoss(), Adam())
|
|
141
141
|
|
|
142
142
|
The QNN can be trained utilizing the :meth:`fit <squlearn.qnn.QNNRegressor.fit>` method:
|
|
143
143
|
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"cell_type": "markdown",
|
|
30
30
|
"metadata": {},
|
|
31
31
|
"source": [
|
|
32
|
-
"The following
|
|
32
|
+
"The following cells shows different ways to initialize of the ``Executor`` class with Qiskit backends or services."
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
{
|
|
@@ -60,20 +60,20 @@
|
|
|
60
60
|
"# from a backend obtained from the Qiskit IBM runtime service (here, the account has to be set-up previously):\n",
|
|
61
61
|
"service = QiskitRuntimeService(channel=\"ibm_quantum\")\n",
|
|
62
62
|
"# Alternative: service = QiskitRuntimeService(channel=\"ibm_quantum\",token=\"YOUR_TOKEN_HERE\")\n",
|
|
63
|
-
"executor = Executor(service.get_backend(\"
|
|
63
|
+
"executor = Executor(service.get_backend(\"ibm_kyoto\"))\n",
|
|
64
64
|
"# from a session set-up with the Qiskit IBM runtime service:\n",
|
|
65
|
-
"session = Session(service, backend=service.get_backend(\"
|
|
65
|
+
"session = Session(service, backend=service.get_backend(\"ibm_kyoto\"), max_time=28800)\n",
|
|
66
66
|
"executor = Executor(session)\n",
|
|
67
67
|
"\n",
|
|
68
68
|
"# from the Qiskit IBM runtime Estimator primitive:\n",
|
|
69
|
-
"session = Session(service, backend=service.get_backend(\"
|
|
69
|
+
"session = Session(service, backend=service.get_backend(\"ibm_kyoto\"), max_time=28800)\n",
|
|
70
70
|
"estimator = RuntimeEstimator(session=session)\n",
|
|
71
71
|
"executor = Executor(estimator)"
|
|
72
72
|
]
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"cell_type": "code",
|
|
76
|
-
"execution_count":
|
|
76
|
+
"execution_count": 4,
|
|
77
77
|
"metadata": {},
|
|
78
78
|
"outputs": [],
|
|
79
79
|
"source": [
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
"cell_type": "code",
|
|
96
|
-
"execution_count":
|
|
96
|
+
"execution_count": 5,
|
|
97
97
|
"metadata": {},
|
|
98
98
|
"outputs": [
|
|
99
99
|
{
|
|
@@ -126,15 +126,15 @@
|
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
"cell_type": "code",
|
|
129
|
-
"execution_count":
|
|
129
|
+
"execution_count": 6,
|
|
130
130
|
"metadata": {},
|
|
131
131
|
"outputs": [
|
|
132
132
|
{
|
|
133
133
|
"name": "stdout",
|
|
134
134
|
"output_type": "stream",
|
|
135
135
|
"text": [
|
|
136
|
-
"EstimatorResult(values=array([-0.
|
|
137
|
-
"SamplerResult(quasi_dists=[{
|
|
136
|
+
"EstimatorResult(values=array([-0.11825966]), metadata=[{'variance': 0.9860146523163866, 'shots': 4321}])\n",
|
|
137
|
+
"SamplerResult(quasi_dists=[{0: 0.3935546875, 3: 0.541015625, 1: 0.02734375, 2: 0.0380859375}], metadata=[{'shots': 1024}])\n"
|
|
138
138
|
]
|
|
139
139
|
}
|
|
140
140
|
],
|
|
@@ -163,22 +163,22 @@
|
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
"cell_type": "code",
|
|
166
|
-
"execution_count":
|
|
166
|
+
"execution_count": 7,
|
|
167
167
|
"metadata": {},
|
|
168
168
|
"outputs": [
|
|
169
169
|
{
|
|
170
170
|
"data": {
|
|
171
171
|
"text/plain": [
|
|
172
|
-
"Result(backend_name='aer_simulator', backend_version='0.13.
|
|
172
|
+
"Result(backend_name='aer_simulator', backend_version='0.13.2', qobj_id='', job_id='3fa1608d-e234-4d64-b957-9c61555f4a89', success=True, results=[ExperimentResult(shots=1024, success=True, meas_level=2, data=ExperimentResultData(), header=QobjExperimentHeader(creg_sizes=[], global_phase=0.0, memory_slots=0, n_qubits=2, name='circuit-158', qreg_sizes=[['q', 2]], metadata={}), status=DONE, seed_simulator=1643401811, metadata={'batched_shots_optimization': False, 'required_memory_mb': 0, 'method': 'stabilizer', 'active_input_qubits': [], 'device': 'CPU', 'remapped_qubits': False, 'num_qubits': 0, 'num_clbits': 0, 'time_taken': 1.84e-05, 'input_qubit_map': [], 'max_memory_mb': 16135, 'measure_sampling': False, 'parallel_shots': 1, 'parallel_state_update': 12, 'runtime_parameter_bind': False, 'num_bind_params': 1}, time_taken=1.84e-05)], date=2024-04-10T17:05:42.732421, status=COMPLETED, header=None, metadata={'omp_enabled': True, 'parallel_experiments': 1, 'max_memory_mb': 16135, 'max_gpu_memory_mb': 0, 'time_taken_execute': 6.57e-05, 'time_taken_parameter_binding': 5.7e-06}, time_taken=0.0)"
|
|
173
173
|
]
|
|
174
174
|
},
|
|
175
|
-
"execution_count":
|
|
175
|
+
"execution_count": 7,
|
|
176
176
|
"metadata": {},
|
|
177
177
|
"output_type": "execute_result"
|
|
178
178
|
}
|
|
179
179
|
],
|
|
180
180
|
"source": [
|
|
181
|
-
"job = executor.
|
|
181
|
+
"job = executor.qiskit_execute(circuit)\n",
|
|
182
182
|
"job.result()"
|
|
183
183
|
]
|
|
184
184
|
},
|
|
@@ -191,14 +191,14 @@
|
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
193
|
"cell_type": "code",
|
|
194
|
-
"execution_count":
|
|
194
|
+
"execution_count": 8,
|
|
195
195
|
"metadata": {},
|
|
196
196
|
"outputs": [
|
|
197
197
|
{
|
|
198
198
|
"name": "stdout",
|
|
199
199
|
"output_type": "stream",
|
|
200
200
|
"text": [
|
|
201
|
-
"EstimatorResult(values=array([-0.
|
|
201
|
+
"EstimatorResult(values=array([-0.10807683]), metadata=[{'variance': 0.9883193979382295, 'shots': 4321}])\n"
|
|
202
202
|
]
|
|
203
203
|
}
|
|
204
204
|
],
|
|
@@ -219,16 +219,16 @@
|
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
221
|
"cell_type": "code",
|
|
222
|
-
"execution_count":
|
|
222
|
+
"execution_count": 9,
|
|
223
223
|
"metadata": {},
|
|
224
224
|
"outputs": [
|
|
225
225
|
{
|
|
226
226
|
"name": "stdout",
|
|
227
227
|
"output_type": "stream",
|
|
228
228
|
"text": [
|
|
229
|
-
"EstimatorResult(values=array([-0.
|
|
230
|
-
"EstimatorResult(values=array([-0.
|
|
231
|
-
"EstimatorResult(values=array([-0.
|
|
229
|
+
"EstimatorResult(values=array([-0.11455682]), metadata=[{'variance': 0.9868767360105952, 'shots': 4321}])\n",
|
|
230
|
+
"EstimatorResult(values=array([-0.11345219]), metadata=[{'variance': 0.9871286010365417, 'shots': 1234}])\n",
|
|
231
|
+
"EstimatorResult(values=array([-0.11455682]), metadata=[{'variance': 0.9868767360105952, 'shots': 4321}])\n"
|
|
232
232
|
]
|
|
233
233
|
}
|
|
234
234
|
],
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
"name": "python",
|
|
267
267
|
"nbconvert_exporter": "python",
|
|
268
268
|
"pygments_lexer": "ipython3",
|
|
269
|
-
"version": "3.10.
|
|
269
|
+
"version": "3.10.2"
|
|
270
270
|
},
|
|
271
271
|
"orig_nbformat": 4,
|
|
272
272
|
"vscode": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"reg = QNNRegressor(\n",
|
|
51
51
|
" ChebyshevRx(nqubits, 1, num_layers=number_of_layers),\n",
|
|
52
52
|
" IsingHamiltonian(nqubits, I=\"S\", Z=\"S\", ZZ=\"S\"),\n",
|
|
53
|
-
" Executor(
|
|
53
|
+
" Executor(),\n",
|
|
54
54
|
" SquaredLoss(),\n",
|
|
55
55
|
" SLSQP(),\n",
|
|
56
56
|
")"
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"name": "stdout",
|
|
101
101
|
"output_type": "stream",
|
|
102
102
|
"text": [
|
|
103
|
-
"fit: 55%|█████▌ | 55/100 [
|
|
103
|
+
"fit: 55%|█████▌ | 55/100 [00:12<00:10, 4.38it/s]\n"
|
|
104
104
|
]
|
|
105
105
|
}
|
|
106
106
|
],
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"name": "stdout",
|
|
137
137
|
"output_type": "stream",
|
|
138
138
|
"text": [
|
|
139
|
-
"{'batch_size': 'None', 'caching': 'True', 'callback': 'pbar', 'closed': 'False', 'encoding_circuit': '<squlearn.encoding_circuit.circuit_library.chebyshev_rx.ChebyshevRx object at
|
|
139
|
+
"{'batch_size': 'None', 'caching': 'True', 'callback': 'pbar', 'closed': 'False', 'encoding_circuit': '<squlearn.encoding_circuit.circuit_library.chebyshev_rx.ChebyshevRx object at 0x000002711B598EB0>', 'epochs': 'None', 'executor': '<squlearn.util.executor.Executor object at 0x000002711B599870>', 'I': 'S', 'loss': '<squlearn.qnn.loss.SquaredLoss object at 0x000002711B599600>', 'num_features': '1', 'num_layers': '2', 'num_qubits': '4', 'operator': \"SparsePauliOp(['IIII', 'IIIZ', 'IIZI', 'IZII', 'ZIII', 'IIZZ', 'IZIZ', 'IZZI', 'ZIIZ', 'ZIZI', 'ZZII'],\\n coeffs=[ParameterExpression(1.0*p[0]), ParameterExpression(1.0*p[1]),\\n ParameterExpression(1.0*p[1]), ParameterExpression(1.0*p[1]),\\n ParameterExpression(1.0*p[1]), ParameterExpression(1.0*p[2]),\\n ParameterExpression(1.0*p[2]), ParameterExpression(1.0*p[2]),\\n ParameterExpression(1.0*p[2]), ParameterExpression(1.0*p[2]),\\n ParameterExpression(1.0*p[2])])\", 'optimizer': '<squlearn.optimizers.optimizers_wrapper.SLSQP object at 0x000002711B599270>', 'opt_param_op': 'True', 'parameter_seed': '0', 'param_ini': '[ 0.01 1.34 2.67 4. -0.47969104 0.91667975\\n -0.39215112 2.46158236 0.01 1.34 2.67 4.\\n 0.42753659 2.67410254 -2.69525994 -2.59414312]', 'param_op_ini': '[1. 1. 1.]', 'pretrained': 'False', 'shot_control': 'None', 'shuffle': 'None', 'variance': 'None', 'X': 'N', 'Z': 'S', 'ZZ': 'S'}\n"
|
|
140
140
|
]
|
|
141
141
|
}
|
|
142
142
|
],
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
"name": "stdout",
|
|
162
162
|
"output_type": "stream",
|
|
163
163
|
"text": [
|
|
164
|
-
"{'accuracy': 0.
|
|
164
|
+
"{'accuracy': 0.9999759983564921}\n"
|
|
165
165
|
]
|
|
166
166
|
}
|
|
167
167
|
],
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"name": "stdout",
|
|
186
186
|
"output_type": "stream",
|
|
187
187
|
"text": [
|
|
188
|
-
"['model/MLmodel', 'model/conda.yaml', 'model/model.pkl', 'model/python_env.yaml', 'model/requirements.txt']\n"
|
|
188
|
+
"['model/MLmodel', 'model/conda.yaml', 'model/metadata', 'model/model.pkl', 'model/python_env.yaml', 'model/requirements.txt']\n"
|
|
189
189
|
]
|
|
190
190
|
}
|
|
191
191
|
],
|
|
@@ -212,8 +212,8 @@
|
|
|
212
212
|
{
|
|
213
213
|
"data": {
|
|
214
214
|
"text/plain": [
|
|
215
|
-
"array([-2.
|
|
216
|
-
" -0.
|
|
215
|
+
"array([-2.30217964, -1.61179577, -1.19923184, -0.92138725, -0.68878989,\n",
|
|
216
|
+
" -0.5136204 , -0.35529528, -0.22364429])"
|
|
217
217
|
]
|
|
218
218
|
},
|
|
219
219
|
"execution_count": 8,
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
"name": "python",
|
|
247
247
|
"nbconvert_exporter": "python",
|
|
248
248
|
"pygments_lexer": "ipython3",
|
|
249
|
-
"version": "3.
|
|
249
|
+
"version": "3.10.2"
|
|
250
250
|
},
|
|
251
251
|
"orig_nbformat": 4
|
|
252
252
|
},
|