squlearn 0.8.0__tar.gz → 0.8.2__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.8.0 → squlearn-0.8.2}/.github/workflows/publish_docs.yml +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/PKG-INFO +8 -7
- {squlearn-0.8.0 → squlearn-0.8.2}/README.md +2 -2
- squlearn-0.8.2/docs/_static/qkm/QKM_scheme_pic.jpg +0 -0
- squlearn-0.8.2/docs/_static/qrc/QRC_user_guide.png +0 -0
- squlearn-0.8.2/docs/_static/qrc/qrc_classification_transparent.png +0 -0
- squlearn-0.8.2/docs/_static/qrc/qrc_regression_transparent.png +0 -0
- squlearn-0.8.2/docs/_static/schematic.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/conf.py +2 -2
- squlearn-0.8.2/docs/examples/example_qnn_ode_solver.nblink +6 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/examples/examples_index.rst +2 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/modules/classes.rst +19 -19
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/user_guide/executor.rst +8 -8
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/user_guide/kernel_methods.rst +17 -2
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/user_guide/quantum_neural_networks.rst +15 -13
- squlearn-0.8.2/docs/user_guide/quantum_reservoir_computing.rst +264 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/user_guide/user_guide_index.rst +1 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/encoding_circuits/various_encoding_circuit.ipynb +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/executor/example_executor_qiskit.ipynb +3 -3
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/kernel/example_projected_kernel.ipynb +3 -3
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/kernel/example_regularization_mitigation.ipynb +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/kernel/qgpc_workflow.ipynb +3 -3
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/qnn/example_adam.ipynb +4 -6
- squlearn-0.8.2/examples/qnn/example_qcnn_encoding_circuit.ipynb +651 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/qnn/ode_example.ipynb +2 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/qrc/qrc_classification.ipynb +114 -5
- squlearn-0.8.2/examples/qrc/qrc_regression.ipynb +417 -0
- squlearn-0.8.2/examples/tutorials/images/QNN_ode_workflow.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/tutorials/kernel_digit_classification.ipynb +6 -6
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/tutorials/kernel_grid_search.ipynb +13 -13
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/tutorials/kernel_regression.ipynb +2 -2
- squlearn-0.8.2/examples/tutorials/qnn_ode_solver.ipynb +303 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/tutorials/quantum_bayesian_optimization.ipynb +5 -5
- squlearn-0.8.2/output.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/pyproject.toml +3 -2
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/__init__.py +2 -2
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/kyriienko_nonlinear_encoding_circuit.py +4 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/qcnn_encoding_circuit.py +2 -2
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/transpiled_encoding_circuit.py +3 -1
- squlearn-0.8.2/src/squlearn/kernel/__init__.py +18 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/kernel/loss/kernel_loss_base.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/kernel/loss/negative_log_likelihood.py +2 -2
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/kernel/loss/target_alignment.py +1 -1
- {squlearn-0.8.0/src/squlearn/kernel/matrix → squlearn-0.8.2/src/squlearn/kernel/lowlevel_kernel}/fidelity_kernel.py +2 -2
- {squlearn-0.8.0/src/squlearn/kernel/matrix → squlearn-0.8.2/src/squlearn/kernel/lowlevel_kernel}/fidelity_kernel_pennylane.py +1 -1
- {squlearn-0.8.0/src/squlearn/kernel/matrix → squlearn-0.8.2/src/squlearn/kernel/lowlevel_kernel}/kernel_matrix_base.py +1 -1
- {squlearn-0.8.0/src/squlearn/kernel/matrix → squlearn-0.8.2/src/squlearn/kernel/lowlevel_kernel}/projected_quantum_kernel.py +5 -5
- {squlearn-0.8.0/src/squlearn/kernel/ml → squlearn-0.8.2/src/squlearn/kernel}/qgpc.py +7 -6
- {squlearn-0.8.0/src/squlearn/kernel/ml → squlearn-0.8.2/src/squlearn/kernel}/qgpr.py +30 -17
- {squlearn-0.8.0/src/squlearn/kernel/ml → squlearn-0.8.2/src/squlearn/kernel}/qkrr.py +20 -10
- {squlearn-0.8.0/src/squlearn/kernel/ml → squlearn-0.8.2/src/squlearn/kernel}/qsvc.py +6 -4
- {squlearn-0.8.0/src/squlearn/kernel/ml → squlearn-0.8.2/src/squlearn/kernel}/qsvr.py +6 -4
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/optimizers/optimizers_wrapper.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/qnn/__init__.py +3 -7
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/qnn/base_qnn.py +15 -4
- squlearn-0.8.2/src/squlearn/qnn/loss/__init__.py +15 -0
- squlearn-0.8.2/src/squlearn/qnn/loss/ode_loss.py +607 -0
- squlearn-0.8.2/src/squlearn/qnn/loss/parameter_regularization_loss.py +189 -0
- squlearn-0.8.2/src/squlearn/qnn/loss/qnn_loss_base.py +363 -0
- squlearn-0.8.2/src/squlearn/qnn/loss/squared_loss.py +144 -0
- squlearn-0.8.2/src/squlearn/qnn/loss/variance_loss.py +116 -0
- squlearn-0.8.2/src/squlearn/qnn/lowlevel_qnn/__init__.py +3 -0
- {squlearn-0.8.0/src/squlearn/qnn → squlearn-0.8.2/src/squlearn/qnn/lowlevel_qnn}/lowlevel_qnn.py +10 -8
- {squlearn-0.8.0/src/squlearn/qnn → squlearn-0.8.2/src/squlearn/qnn/lowlevel_qnn}/lowlevel_qnn_base.py +3 -3
- {squlearn-0.8.0/src/squlearn/qnn → squlearn-0.8.2/src/squlearn/qnn/lowlevel_qnn}/lowlevel_qnn_pennylane.py +8 -7
- {squlearn-0.8.0/src/squlearn/qnn → squlearn-0.8.2/src/squlearn/qnn/lowlevel_qnn}/lowlevel_qnn_qiskit.py +8 -8
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/qnn/qnnc.py +17 -5
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/qnn/qnnr.py +19 -6
- squlearn-0.8.2/src/squlearn/qnn/util/__init__.py +5 -0
- {squlearn-0.8.0/src/squlearn/qnn → squlearn-0.8.2/src/squlearn/qnn/util}/barren_plateau_analysis.py +2 -3
- {squlearn-0.8.0/src/squlearn/qnn → squlearn-0.8.2/src/squlearn/qnn/util}/training.py +12 -10
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/qrc/base_qrc.py +16 -3
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/qrc/qrc_classifier.py +1 -1
- squlearn-0.8.2/src/squlearn/util/decompose_to_std.py +40 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/executor.py +49 -96
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/optree/optree.py +3 -3
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/optree/optree_evaluate.py +6 -13
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/pennylane/pennylane_circuit.py +6 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/kernel/matrix/test_projected_quantum_kernel.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/kernel/ml/test_qgpc.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/kernel/ml/test_qgpr.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/kernel/ml/test_qkrr.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/kernel/ml/test_qsvc.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/kernel/ml/test_qsvr.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/qnn/test_training.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/qrc/test_base_qrc.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/qrc/test_qrc_classifier.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/qrc/test_qrc_regressor.py +1 -1
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/util/optree/test_optree_evaluate.py +1 -1
- squlearn-0.8.0/docs/_static/schematic.png +0 -0
- squlearn-0.8.0/examples/qnn/example_qcnn_encoding_circuit.ipynb +0 -440
- squlearn-0.8.0/examples/qrc/qrc_regression.ipynb +0 -207
- squlearn-0.8.0/src/squlearn/kernel/__init__.py +0 -17
- squlearn-0.8.0/src/squlearn/kernel/ml/__init__.py +0 -8
- squlearn-0.8.0/src/squlearn/qnn/loss.py +0 -1389
- {squlearn-0.8.0 → squlearn-0.8.2}/.github/CODE_OF_CONDUCT.md +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/.github/CONTRIBUTING.md +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/.github/workflows/doc_checks.yml +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/.github/workflows/format.yml +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/.github/workflows/publish.yml +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/.github/workflows/tests.yaml +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/.gitignore +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/CITATION.cff +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/LICENSE.txt +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/Makefile +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/README.md +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/_static/css/custom.css +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/_static/favicon.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/_static/logo.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/_static/qnn/qnn.svg +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/_static/util/executor.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/_templates/class.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/_templates/class_with_call.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/_templates/function.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/examples/example_kernel_digit_classification.nblink +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/examples/example_kernel_grid_search.nblink +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/examples/example_qnn_backend_mitigation.nblink +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/examples/example_quantum_bayesian_optimization.nblink +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/index.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/install/install.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/make.bat +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/qiskit_settings.conf +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/spelling_wordlist.txt +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/user_guide/encoding_circuits.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/docs/user_guide/observables.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/encoding_circuits/layered_encoding_circuit.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/encoding_circuits/pruning_example.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/integration/mlflow.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/kernel/example_fidelity_kernel.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/kernel/qgpr_optimization_workflow.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/kernel/qgpr_workflow.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/qnn/classification_example.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/qnn/example_minibatch.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/qnn/regression_example.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/qnn/regression_with_variance.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/tutorials/images/encoding_circuit.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/tutorials/images/pipeline.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/tutorials/images/projected_quantum_kernel.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/tutorials/images/quantum_bo.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/examples/tutorials/qnn_backend_mitigation.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/install_lowest_dependencies.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/chebyshev_pqc.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/chebyshev_rx.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/chebyshev_tower.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/highdim_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/hubregtsen_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/multi_control_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/param_z_feature_map.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/qiskit_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/random_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/random_layered_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/circuit_library/yz_cx_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/encoding_circuit_base.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/encoding_circuit_derivatives.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/layered_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/encoding_circuit/pruned_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/kernel/loss/__init__.py +0 -0
- {squlearn-0.8.0/src/squlearn/kernel/matrix → squlearn-0.8.2/src/squlearn/kernel/lowlevel_kernel}/__init__.py +0 -0
- {squlearn-0.8.0/src/squlearn/kernel/matrix → squlearn-0.8.2/src/squlearn/kernel/lowlevel_kernel}/kernel_optimizer.py +0 -0
- {squlearn-0.8.0/src/squlearn/kernel/matrix → squlearn-0.8.2/src/squlearn/kernel/lowlevel_kernel}/kernel_util.py +0 -0
- {squlearn-0.8.0/src/squlearn/kernel/matrix → squlearn-0.8.2/src/squlearn/kernel/lowlevel_kernel}/regularization.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/observables/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/observables/observable_base.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/observables/observable_derivatives.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/observables/observable_implemented/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/observables/observable_implemented/custom_observable.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/observables/observable_implemented/ising_hamiltonian.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/observables/observable_implemented/single_pauli.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/observables/observable_implemented/single_probability.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/observables/observable_implemented/summed_paulis.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/observables/observable_implemented/summed_probabilities.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/optimizers/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/optimizers/adam.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/optimizers/approximated_gradients.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/optimizers/optimizer_base.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/optimizers/sglbo.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/qrc/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/qrc/qrc_regressor.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/data_preprocessing.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/execution/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/execution/automatic_backend_selection.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/execution/hqaa/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/execution/hqaa/heuristic.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/execution/hqaa/parser.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/execution/parallel_estimator.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/execution/parallel_sampler.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/optree/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/optree/optree_derivative.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/pennylane/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/pennylane/pennylane_gates.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/src/squlearn/util/qfi.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/encoding_circuit/test_layered_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/encoding_circuit/test_random_encoding_circuits.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/kernel/matrix/test_kernel_optimizer.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/optimizers/test_sglbo.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/qnn/test_base_qnn.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/qnn/test_qnnc.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/qnn/test_qnnr.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/util/execution/test_automatic_backend_selection.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/util/execution/test_parallel_primitives.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/util/optree/test_optree_derivative.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.2}/tests/util/test_executor.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: squlearn
|
|
3
|
-
Version: 0.8.
|
|
4
|
-
Summary: A library for quantum machine learning following the scikit-
|
|
3
|
+
Version: 0.8.2
|
|
4
|
+
Summary: A library for quantum machine learning following the scikit-learn standard.
|
|
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>
|
|
7
7
|
Maintainer-email: David Kreplin <david.kreplin@ipa.fraunhofer.de>, Moritz Willmann <moritz.willmann@ipa.fraunhofer.de>
|
|
@@ -10,19 +10,20 @@ Description-Content-Type: text/markdown
|
|
|
10
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
11
|
Classifier: Programming Language :: Python
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
License-File: LICENSE.txt
|
|
13
14
|
Requires-Dist: bayesian-optimization>=1.4.3,<2
|
|
14
15
|
Requires-Dist: dill>=0.3.4
|
|
15
16
|
Requires-Dist: mapomatic>=0.10.0
|
|
16
17
|
Requires-Dist: networkx>=3.0
|
|
17
18
|
Requires-Dist: numpy>=1.20
|
|
18
19
|
Requires-Dist: pennylane>=0.34.0
|
|
19
|
-
Requires-Dist: qiskit>=0.45.0
|
|
20
|
+
Requires-Dist: qiskit>=0.45.0,<2
|
|
20
21
|
Requires-Dist: qiskit-aer>=0.12.0
|
|
21
22
|
Requires-Dist: qiskit-algorithms>=0.3.0
|
|
22
23
|
Requires-Dist: qiskit-ibm-runtime>=0.18.0
|
|
23
24
|
Requires-Dist: qiskit-machine-learning>=0.7.0
|
|
24
25
|
Requires-Dist: scipy>=1.8.0
|
|
25
|
-
Requires-Dist: scikit-learn>=1.2.0
|
|
26
|
+
Requires-Dist: scikit-learn>=1.2.0
|
|
26
27
|
Requires-Dist: tqdm>=4.1.0
|
|
27
28
|
Requires-Dist: black ; extra == "dev"
|
|
28
29
|
Requires-Dist: flit ; extra == "dev"
|
|
@@ -58,10 +59,10 @@ Provides-Extra: examples
|
|
|
58
59
|
|
|
59
60
|
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 tool set 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.
|
|
60
61
|
|
|
61
|
-
sQUlearn offers scikit-learn compatible high-level interfaces for various kernel methods and
|
|
62
|
+
sQUlearn offers scikit-learn compatible high-level interfaces for various kernel methods, QNNs and quantum reservoir computing. 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.
|
|
62
63
|
|
|
63
64
|
<p align="center">
|
|
64
|
-
<img width=
|
|
65
|
+
<img width=600px alt="sQUlearn schematic" src="https://raw.githubusercontent.com/sQUlearn/squlearn/main/docs/_static/schematic.png" />
|
|
65
66
|
</p>
|
|
66
67
|
|
|
67
68
|
---
|
|
@@ -4,10 +4,10 @@
|
|
|
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 tool set 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
|
|
7
|
+
sQUlearn offers scikit-learn compatible high-level interfaces for various kernel methods, QNNs and quantum reservoir computing. 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
|
-
<img width=
|
|
10
|
+
<img width=600px alt="sQUlearn schematic" src="https://raw.githubusercontent.com/sQUlearn/squlearn/main/docs/_static/schematic.png" />
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
---
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -107,9 +107,9 @@ latex_elements = {
|
|
|
107
107
|
# intersphinx
|
|
108
108
|
intersphinx_mapping = {
|
|
109
109
|
"pennylane": ("https://docs.pennylane.ai/en/stable/", None),
|
|
110
|
-
"qiskit": ("https://docs.quantum.ibm.com/api/qiskit/
|
|
110
|
+
"qiskit": ("https://docs.quantum.ibm.com/api/qiskit/", None),
|
|
111
111
|
"qiskit-aer": ("https://qiskit.github.io/qiskit-aer/", None),
|
|
112
|
-
"qiskit-ibm-runtime": ("https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/
|
|
112
|
+
"qiskit-ibm-runtime": ("https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/", None),
|
|
113
113
|
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
|
|
114
114
|
"sklearn": ("https://scikit-learn.org/1.4/", None),
|
|
115
115
|
}
|
|
@@ -16,9 +16,9 @@ QML Regressors
|
|
|
16
16
|
:toctree: generated/
|
|
17
17
|
:template: class.rst
|
|
18
18
|
|
|
19
|
-
kernel.
|
|
20
|
-
kernel.
|
|
21
|
-
kernel.
|
|
19
|
+
kernel.QSVR
|
|
20
|
+
kernel.QKRR
|
|
21
|
+
kernel.QGPR
|
|
22
22
|
qnn.QNNRegressor
|
|
23
23
|
qrc.QRCRegressor
|
|
24
24
|
|
|
@@ -33,8 +33,8 @@ QML Classifiers
|
|
|
33
33
|
:toctree: generated/
|
|
34
34
|
:template: class.rst
|
|
35
35
|
|
|
36
|
-
kernel.
|
|
37
|
-
kernel.
|
|
36
|
+
kernel.QSVC
|
|
37
|
+
kernel.QGPC
|
|
38
38
|
qnn.QNNClassifier
|
|
39
39
|
qrc.QRCClassifier
|
|
40
40
|
|
|
@@ -155,7 +155,7 @@ Core
|
|
|
155
155
|
Quantum Kernel Core
|
|
156
156
|
------------------------------------
|
|
157
157
|
|
|
158
|
-
.. automodule:: squlearn.kernel.
|
|
158
|
+
.. automodule:: squlearn.kernel.lowlevel_kernel
|
|
159
159
|
:no-members:
|
|
160
160
|
:no-inherited-members:
|
|
161
161
|
|
|
@@ -166,8 +166,8 @@ Quantum Kernel Core
|
|
|
166
166
|
:toctree: generated/
|
|
167
167
|
:template: class.rst
|
|
168
168
|
|
|
169
|
-
kernel.
|
|
170
|
-
kernel.
|
|
169
|
+
kernel.lowlevel_kernel.FidelityKernel
|
|
170
|
+
kernel.lowlevel_kernel.ProjectedQuantumKernel
|
|
171
171
|
|
|
172
172
|
.. automodule:: squlearn.kernel.loss
|
|
173
173
|
:no-members:
|
|
@@ -198,10 +198,10 @@ QNN Core
|
|
|
198
198
|
:template: class.rst
|
|
199
199
|
|
|
200
200
|
qnn.lowlevel_qnn.LowLevelQNN
|
|
201
|
-
qnn.lowlevel_qnn_qiskit.LowLevelQNNQiskit
|
|
202
|
-
qnn.lowlevel_qnn_qiskit.Expec
|
|
203
|
-
qnn.lowlevel_qnn_pennylane.LowLevelQNNPennyLane
|
|
204
|
-
qnn.lowlevel_qnn_base.LowLevelQNNBase
|
|
201
|
+
qnn.lowlevel_qnn.lowlevel_qnn_qiskit.LowLevelQNNQiskit
|
|
202
|
+
qnn.lowlevel_qnn.lowlevel_qnn_qiskit.Expec
|
|
203
|
+
qnn.lowlevel_qnn.lowlevel_qnn_pennylane.LowLevelQNNPennyLane
|
|
204
|
+
qnn.lowlevel_qnn.lowlevel_qnn_base.LowLevelQNNBase
|
|
205
205
|
qnn.loss.SquaredLoss
|
|
206
206
|
qnn.loss.VarianceLoss
|
|
207
207
|
qnn.loss.ODELoss
|
|
@@ -214,11 +214,11 @@ Tools for training QNNs
|
|
|
214
214
|
:toctree: generated/
|
|
215
215
|
:template: class.rst
|
|
216
216
|
|
|
217
|
-
qnn.get_variance_fac
|
|
218
|
-
qnn.get_lr_decay
|
|
219
|
-
qnn.ShotsFromRSTD
|
|
220
|
-
qnn.training.train
|
|
221
|
-
qnn.training.train_mini_batch
|
|
217
|
+
qnn.util.get_variance_fac
|
|
218
|
+
qnn.util.get_lr_decay
|
|
219
|
+
qnn.util.ShotsFromRSTD
|
|
220
|
+
qnn.util.training.train
|
|
221
|
+
qnn.util.training.train_mini_batch
|
|
222
222
|
|
|
223
223
|
|
|
224
224
|
Implemented optimizers
|
|
@@ -286,11 +286,11 @@ Base Classes
|
|
|
286
286
|
|
|
287
287
|
observables.observable_base.ObservableBase
|
|
288
288
|
encoding_circuit.encoding_circuit_base.EncodingCircuitBase
|
|
289
|
-
kernel.
|
|
289
|
+
kernel.lowlevel_kernel.kernel_matrix_base.KernelMatrixBase
|
|
290
290
|
kernel.loss.kernel_loss_base.KernelLossBase
|
|
291
291
|
optimizers.optimizer_base.OptimizerBase
|
|
292
292
|
qnn.base_qnn.BaseQNN
|
|
293
|
-
qnn.loss.
|
|
293
|
+
qnn.loss.qnn_loss_base.QNNLossBase
|
|
294
294
|
qrc.base_qrc.BaseQRC
|
|
295
295
|
|
|
296
296
|
|
|
@@ -143,7 +143,7 @@ execution environment:
|
|
|
143
143
|
executor = Executor(dev, shots = 1234)
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
- A :class:`Backend <qiskit.providers.Backend>` from :class:`QiskitRuntimeService <qiskit_ibm_runtime.QiskitRuntimeService>`'s :meth:`
|
|
146
|
+
- A :class:`Backend <qiskit.providers.Backend>` from :class:`QiskitRuntimeService <qiskit_ibm_runtime.QiskitRuntimeService>`'s :meth:`backend <qiskit_ibm_runtime.QiskitRuntimeservice.backend>` method, which utilizes the execution of quantum jobs on IBM Quantum.
|
|
147
147
|
Sessions and Primitives are automatically created and managed by the :class:`Executor <squlearn.Executor>` class (remember to close the session at the end of your code when running on IBM Quantum).
|
|
148
148
|
|
|
149
149
|
.. code-block:: python
|
|
@@ -152,7 +152,7 @@ execution environment:
|
|
|
152
152
|
from qiskit_ibm_runtime import QiskitRuntimeService
|
|
153
153
|
|
|
154
154
|
service = QiskitRuntimeService(channel="ibm_quantum", token="INSERT_YOUR_TOKEN_HERE")
|
|
155
|
-
executor = Executor(service.
|
|
155
|
+
executor = Executor(service.backend('ibm_brisbane'))
|
|
156
156
|
...
|
|
157
157
|
# Close the session at the end of your code
|
|
158
158
|
executor.close_session()
|
|
@@ -179,7 +179,7 @@ execution environment:
|
|
|
179
179
|
from qiskit_ibm_runtime import QiskitRuntimeService
|
|
180
180
|
|
|
181
181
|
service = QiskitRuntimeService(channel="ibm_quantum", token="INSERT_YOUR_TOKEN_HERE")
|
|
182
|
-
session = service.create_session(backend = service.
|
|
182
|
+
session = service.create_session(backend = service.backend('ibm_brisbane'))
|
|
183
183
|
executor = Executor(session)
|
|
184
184
|
...
|
|
185
185
|
executor.close_session()
|
|
@@ -195,7 +195,7 @@ execution environment:
|
|
|
195
195
|
|
|
196
196
|
service = QiskitRuntimeService(channel="ibm_quantum", token="INSERT_YOUR_TOKEN_HERE")
|
|
197
197
|
|
|
198
|
-
session = service.create_session(backend = service.
|
|
198
|
+
session = service.create_session(backend = service.backend('ibm_brisbane'))
|
|
199
199
|
estimator = Estimator(session=session)
|
|
200
200
|
estimator.options.resilience.zne_mitigation = True
|
|
201
201
|
estimator.options.resilience.zne.noise_factors = (1, 3, 5)
|
|
@@ -233,7 +233,7 @@ backend from the :class:`QiskitRuntimeService <qiskit_ibm_runtime.QiskitRuntimeS
|
|
|
233
233
|
"zne":{"noise_factors" : (1, 3, 5),"extrapolator":"linear" }}
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
executor = Executor(service.
|
|
236
|
+
executor = Executor(service.backend('ibm_brisbane'), # Specify the backend
|
|
237
237
|
cache_dir='cache', # Set cache folder to "cache"
|
|
238
238
|
caching=True, # Enable caching default for remote executions
|
|
239
239
|
log_file="executor.log", # Set-up logging file
|
|
@@ -296,7 +296,7 @@ They folow the same dictionary datastructure than the original V2 Primtives.
|
|
|
296
296
|
"zne":{"noise_factors" : (1, 3, 5),"extrapolator":"linear" }}
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
executor = Executor(service.
|
|
299
|
+
executor = Executor(service.backend("ibm_brisbane"),options_estimator=options)
|
|
300
300
|
|
|
301
301
|
Alternatively, the options can be adjusted by the attributes :meth:`estimator_options` and :meth:`sampler_options` similar
|
|
302
302
|
to the option interface of the V2 Primtives:
|
|
@@ -307,7 +307,7 @@ to the option interface of the V2 Primtives:
|
|
|
307
307
|
from qiskit_ibm_runtime import QiskitRuntimeService
|
|
308
308
|
|
|
309
309
|
service = QiskitRuntimeService(channel="ibm_quantum", token="INSERT_YOUR_TOKEN_HERE")
|
|
310
|
-
executor = Executor(service.
|
|
310
|
+
executor = Executor(service.backend("ibm_brisbane"))
|
|
311
311
|
executor.sampler_options.dynamical_decoupling.enable = True
|
|
312
312
|
executor.sampler_options.dynamical_decoupling.sequence_type = "XpXm"
|
|
313
313
|
|
|
@@ -321,7 +321,7 @@ Options can be adjusted by the :meth:`set_options` method of the Primitives that
|
|
|
321
321
|
|
|
322
322
|
service = QiskitRuntimeService(channel="ibm_quantum", token="INSERT_YOUR_TOKEN_HERE")
|
|
323
323
|
|
|
324
|
-
executor = Executor(service.
|
|
324
|
+
executor = Executor(service.backend("ibm_brisbane"))
|
|
325
325
|
estimator = executor.get_estimator()
|
|
326
326
|
estimator.set_options(resilience_level=2)
|
|
327
327
|
|
|
@@ -50,8 +50,23 @@ state [1]. In the quantum computational practice, the Hilbert-Schmidt inner prod
|
|
|
50
50
|
measurements. Consequently, in quantum computing, access to the Hilbert space of quantum states is
|
|
51
51
|
given by measurements.
|
|
52
52
|
|
|
53
|
+
.. _figure 1:
|
|
54
|
+
.. figure:: ../_static/qkm/QKM_scheme_pic.jpg
|
|
55
|
+
:alt: Quantum Kernel Methods
|
|
56
|
+
:width: 500
|
|
57
|
+
:align: center
|
|
58
|
+
|
|
59
|
+
**Figure 1** Schematic illustration of the function principle of quantum kernel methods, which can be formally embedded in the rich
|
|
60
|
+
mathematical framework of conventional kernel theory. Data points :math:`\symbf{x}` are mapped to the quantum Hilbert space by
|
|
61
|
+
encoding them into a quantum state :math:`\ket{\symbf{\psi}(\symbf{x})}`. Access to the quantum Hilbert space is granted by
|
|
62
|
+
measurements. :math:`\symbf{Left:}` In quantum mechanics measurements are expressed through Hilbert-Schmidt inner products.
|
|
63
|
+
Quantum kernels, which are defined using this fidelity-type metric are thus referred to as fidelity quantum kernels (FQKs).
|
|
64
|
+
More on FQKs in sQUlearn will be discussed below. :math:`\symbf{Right:}` When projecting the quantum states to an approximate
|
|
65
|
+
classical representation using, e.g., reduced physical observables this gives rise to a family of projected quantum kernels (PQKs).
|
|
66
|
+
These will be also subject to discussion in the sQUlearn context below.
|
|
53
67
|
|
|
54
|
-
|
|
68
|
+
|
|
69
|
+
.. currentmodule:: squlearn.kernel
|
|
55
70
|
|
|
56
71
|
High-Level methods that employ quantum kernels
|
|
57
72
|
----------------------------------------------
|
|
@@ -117,7 +132,7 @@ kernel matrices using either *thresholding* or *tikhonov* approach as described
|
|
|
117
132
|
Regularization is by default switched of but can be set via the :code:`regularization`
|
|
118
133
|
argument.
|
|
119
134
|
|
|
120
|
-
.. currentmodule:: squlearn.kernel.
|
|
135
|
+
.. currentmodule:: squlearn.kernel.lowlevel_kernel
|
|
121
136
|
|
|
122
137
|
Fidelity Quantum Kernel (FQK) via :class:`FidelityKernel`
|
|
123
138
|
#########################################################
|
|
@@ -15,13 +15,13 @@ minimized by a classical optimizer. The resultant QNN can then be employed to pr
|
|
|
15
15
|
for new input data.
|
|
16
16
|
|
|
17
17
|
In many cases, QNNs adhere to a layered design, akin to classical neural networks, as illustrated
|
|
18
|
-
in `
|
|
18
|
+
in `figure_qnn 1`_. However, it is essential to note that they do not adhere to the concept of
|
|
19
19
|
neurons as seen in classical neural networks. Therefore, the term "Quantum Neural Network" may
|
|
20
20
|
be somewhat misleading, as QNNs do not conform to the traditional neural network paradigm.
|
|
21
21
|
Nevertheless, their application domain closely resembles that of classical neural networks,
|
|
22
22
|
which explains the established nomenclature.
|
|
23
23
|
|
|
24
|
-
..
|
|
24
|
+
.. _figure_qnn 1:
|
|
25
25
|
.. figure:: ../_static/qnn/qnn.svg
|
|
26
26
|
:alt: Quantum Neural Network (QNN)
|
|
27
27
|
:width: 600
|
|
@@ -57,7 +57,7 @@ It's worth noting that both the embedding layers :math:`U_i({x})` and the observ
|
|
|
57
57
|
|
|
58
58
|
To train Quantum Neural Networks (QNNs), a hybrid quantum-classical approach is employed.
|
|
59
59
|
The training process consists of two phases: quantum circuit evaluation and classical optimization
|
|
60
|
-
(as illustrated in `
|
|
60
|
+
(as illustrated in `figure_qnn 1`_).
|
|
61
61
|
|
|
62
62
|
In the quantum circuit evaluation phase, the QNN and its gradient with respect to the parameters
|
|
63
63
|
are assessed using a quantum computer or simulator. The gradient can be obtained using the
|
|
@@ -239,13 +239,13 @@ This is possible by providing a :class:`List` or a :class:`Callable` to the lear
|
|
|
239
239
|
Then a learning rate is chosen from the list or calculated by the callable at the beginning of
|
|
240
240
|
each iteration or epoch.
|
|
241
241
|
A suitable function for generating a callable with an exponential decay of the learning rate is
|
|
242
|
-
provided by :meth:`get_lr_decay`. The following example will generate an Adam optimization
|
|
242
|
+
provided by :meth:`util.get_lr_decay`. The following example will generate an Adam optimization
|
|
243
243
|
with an exponential decay in the learning rate from 0.01 to 0.001 over 100 iterations.
|
|
244
244
|
|
|
245
245
|
.. jupyter-execute::
|
|
246
246
|
|
|
247
247
|
from squlearn.optimizers import Adam
|
|
248
|
-
from squlearn.qnn import get_lr_decay
|
|
248
|
+
from squlearn.qnn.util import get_lr_decay
|
|
249
249
|
adam = Adam({'lr':get_lr_decay(0.01, 0.001, 100)})
|
|
250
250
|
|
|
251
251
|
|
|
@@ -263,11 +263,12 @@ The high-level implementations of QNNs, :class:`QNNRegressor` and :class:`QNNCla
|
|
|
263
263
|
can be initialized with a shot controller that takes care to automatically adjust the number of
|
|
264
264
|
shots. The following example will generate a :class:`QNNRegressor`
|
|
265
265
|
with a RSTD threshold of 0.1 and a minimum and maximum number of shots of 100 and 10000.
|
|
266
|
-
It utilizes the :class:`ShotsFromRSTD <squlearn.qnn.ShotsFromRSTD>` shot controller.
|
|
266
|
+
It utilizes the :class:`ShotsFromRSTD <squlearn.qnn.util.ShotsFromRSTD>` shot controller.
|
|
267
267
|
|
|
268
268
|
.. code-block:: python
|
|
269
269
|
|
|
270
|
-
from squlearn.qnn import QNNRegressor
|
|
270
|
+
from squlearn.qnn import QNNRegressor
|
|
271
|
+
from squlearn.qnn.util import ShotsFromRSTD
|
|
271
272
|
reg = QNNRegressor(
|
|
272
273
|
...
|
|
273
274
|
shot_controller = ShotsFromRSTD(rstd_bound=0.1, min_shots=100, max_shots=10000),
|
|
@@ -292,13 +293,13 @@ The noise level of the model thus depends on its variance, which can be calculat
|
|
|
292
293
|
\sigma_f^2 = \langle\Psi\lvert\hat{C}^2\rvert\Psi\rangle -
|
|
293
294
|
\langle\Psi\lvert\hat{C}\rvert\Psi\rangle^2 \text{.}
|
|
294
295
|
|
|
295
|
-
`
|
|
296
|
+
`Figure_qnn 3`_ shows the output of a :class:`QNNRegressor` fit to a logarithm
|
|
296
297
|
with :class:`SquaredLoss <squlearn.qnn.loss.SquaredLoss>` evaluated on Qiskit's
|
|
297
298
|
:class:`QasmSimulator <qiskit_aer.QasmSimulator>`.
|
|
298
299
|
The model has been trained with a noise-free simulator, but evaluating it on a noisy simulator
|
|
299
300
|
yields a high variance in the model output.
|
|
300
301
|
|
|
301
|
-
..
|
|
302
|
+
.. _figure_qnn 2:
|
|
302
303
|
.. plot::
|
|
303
304
|
:caption: **Figure 2** Logarithm and output of :class:`QNNRegressor` :math:`f(\theta, x)` evaluated on Qiskit's
|
|
304
305
|
:class:`QasmSimulator <qiskit_aer.QasmSimulator>`. The QNN output has a high variance.
|
|
@@ -359,9 +360,9 @@ takes the keyword argument ``iteration`` to dynamically adjust the factor. Value
|
|
|
359
360
|
:math:`10^{-2}` and :math:`10^{-4}` have shown to yield satisfying results. `[1]`_
|
|
360
361
|
|
|
361
362
|
Evaluation on Qiskit's :class:`QasmSimulator <qiskit_aer.QasmSimulator>` now yields less variance
|
|
362
|
-
in the model, as depicted in `
|
|
363
|
+
in the model, as depicted in `figure_qnn 3`_.
|
|
363
364
|
|
|
364
|
-
..
|
|
365
|
+
.. _figure_qnn 3:
|
|
365
366
|
.. plot::
|
|
366
367
|
:caption: **Figure 3** Logarithm and output of :class:`QNNRegressor` :math:`f(\theta, x)`, trained with variance
|
|
367
368
|
regularization, evaluated on Qiskit's :class:`QasmSimulator <qiskit_aer.QasmSimulator>`.
|
|
@@ -407,12 +408,13 @@ stages (see Ref. [1]). This can be achieved by passing a :class:`List` or a :cla
|
|
|
407
408
|
to the keyword argument ``variance`` of the :class:`QNNRegressor` (or :class:`QNNClassifier`).
|
|
408
409
|
The following example will generate a :class:`QNNRegressor` with a variance
|
|
409
410
|
regularization factor that is adjusted dynamically during the optimization by utilizing the
|
|
410
|
-
function :meth:`get_variance_fac`. The set-up features a final regularization factor of 0.005,
|
|
411
|
+
function :meth:`util.get_variance_fac`. The set-up features a final regularization factor of 0.005,
|
|
411
412
|
a decay factor of 0.08 and a plateau at :math:`\alpha=1` of 20 iterations at the beginning.
|
|
412
413
|
|
|
413
414
|
.. code-block:: python
|
|
414
415
|
|
|
415
|
-
from squlearn.qnn import QNNRegressor
|
|
416
|
+
from squlearn.qnn import QNNRegressor
|
|
417
|
+
from squlearn.qnn.util import get_variance_fac
|
|
416
418
|
reg = QNNRegressor(
|
|
417
419
|
...
|
|
418
420
|
variance = get_variance_fac(0.005,0.08,20),
|