squlearn 0.8.0__tar.gz → 0.8.1__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.1}/.github/workflows/publish_docs.yml +1 -1
- {squlearn-0.8.0 → squlearn-0.8.1}/PKG-INFO +5 -5
- {squlearn-0.8.0 → squlearn-0.8.1}/README.md +2 -2
- squlearn-0.8.1/docs/_static/qkm/QKM_scheme_pic.jpg +0 -0
- squlearn-0.8.1/docs/_static/qrc/QRC_user_guide.png +0 -0
- squlearn-0.8.1/docs/_static/qrc/qrc_classification_transparent.png +0 -0
- squlearn-0.8.1/docs/_static/qrc/qrc_regression_transparent.png +0 -0
- squlearn-0.8.1/docs/_static/schematic.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/conf.py +2 -2
- squlearn-0.8.1/docs/examples/example_qnn_ode_solver.nblink +6 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/examples/examples_index.rst +2 -1
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/user_guide/kernel_methods.rst +15 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/user_guide/quantum_neural_networks.rst +7 -7
- squlearn-0.8.1/docs/user_guide/quantum_reservoir_computing.rst +264 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/user_guide/user_guide_index.rst +1 -0
- squlearn-0.8.1/examples/qnn/example_qcnn_encoding_circuit.ipynb +651 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/qrc/qrc_classification.ipynb +114 -5
- squlearn-0.8.1/examples/qrc/qrc_regression.ipynb +417 -0
- squlearn-0.8.1/examples/tutorials/images/QNN_ode_workflow.png +0 -0
- squlearn-0.8.1/examples/tutorials/qnn_ode_solver.ipynb +302 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/tutorials/quantum_bayesian_optimization.ipynb +1 -1
- squlearn-0.8.1/output.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/pyproject.toml +1 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/__init__.py +2 -2
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/kyriienko_nonlinear_encoding_circuit.py +4 -1
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/qcnn_encoding_circuit.py +2 -2
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/transpiled_encoding_circuit.py +3 -1
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qnn/lowlevel_qnn_pennylane.py +2 -1
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qrc/qrc_classifier.py +1 -1
- squlearn-0.8.1/src/squlearn/util/decompose_to_std.py +40 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/executor.py +13 -7
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/optree/optree_evaluate.py +2 -9
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/pennylane/pennylane_circuit.py +6 -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 → squlearn-0.8.1}/.github/CODE_OF_CONDUCT.md +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/.github/CONTRIBUTING.md +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/.github/workflows/doc_checks.yml +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/.github/workflows/format.yml +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/.github/workflows/publish.yml +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/.github/workflows/tests.yaml +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/.gitignore +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/CITATION.cff +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/LICENSE.txt +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/Makefile +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/README.md +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/_static/css/custom.css +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/_static/favicon.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/_static/logo.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/_static/qnn/qnn.svg +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/_static/util/executor.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/_templates/class.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/_templates/class_with_call.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/_templates/function.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/examples/example_kernel_digit_classification.nblink +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/examples/example_kernel_grid_search.nblink +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/examples/example_qnn_backend_mitigation.nblink +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/examples/example_quantum_bayesian_optimization.nblink +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/index.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/install/install.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/make.bat +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/modules/classes.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/qiskit_settings.conf +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/spelling_wordlist.txt +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/user_guide/encoding_circuits.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/user_guide/executor.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/docs/user_guide/observables.rst +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/encoding_circuits/layered_encoding_circuit.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/encoding_circuits/pruning_example.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/encoding_circuits/various_encoding_circuit.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/executor/example_executor_qiskit.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/integration/mlflow.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/kernel/example_fidelity_kernel.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/kernel/example_projected_kernel.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/kernel/example_regularization_mitigation.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/kernel/qgpc_workflow.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/kernel/qgpr_optimization_workflow.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/kernel/qgpr_workflow.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/qnn/classification_example.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/qnn/example_adam.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/qnn/example_minibatch.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/qnn/ode_example.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/qnn/regression_example.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/qnn/regression_with_variance.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/tutorials/images/encoding_circuit.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/tutorials/images/pipeline.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/tutorials/images/projected_quantum_kernel.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/tutorials/images/quantum_bo.png +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/tutorials/kernel_digit_classification.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/tutorials/kernel_grid_search.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/tutorials/kernel_regression.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/examples/tutorials/qnn_backend_mitigation.ipynb +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/install_lowest_dependencies.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/chebyshev_pqc.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/chebyshev_rx.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/chebyshev_tower.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/highdim_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/hubregtsen_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/multi_control_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/param_z_feature_map.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/qiskit_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/random_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/random_layered_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/circuit_library/yz_cx_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/encoding_circuit_base.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/encoding_circuit_derivatives.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/layered_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/encoding_circuit/pruned_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/loss/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/loss/kernel_loss_base.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/loss/negative_log_likelihood.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/loss/target_alignment.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/matrix/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/matrix/fidelity_kernel.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/matrix/fidelity_kernel_pennylane.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/matrix/kernel_matrix_base.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/matrix/kernel_optimizer.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/matrix/kernel_util.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/matrix/projected_quantum_kernel.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/matrix/regularization.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/ml/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/ml/qgpc.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/ml/qgpr.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/ml/qkrr.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/ml/qsvc.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/kernel/ml/qsvr.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/observables/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/observables/observable_base.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/observables/observable_derivatives.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/observables/observable_implemented/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/observables/observable_implemented/custom_observable.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/observables/observable_implemented/ising_hamiltonian.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/observables/observable_implemented/single_pauli.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/observables/observable_implemented/single_probability.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/observables/observable_implemented/summed_paulis.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/observables/observable_implemented/summed_probabilities.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/optimizers/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/optimizers/adam.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/optimizers/approximated_gradients.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/optimizers/optimizer_base.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/optimizers/optimizers_wrapper.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/optimizers/sglbo.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qnn/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qnn/barren_plateau_analysis.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qnn/base_qnn.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qnn/loss.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qnn/lowlevel_qnn.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qnn/lowlevel_qnn_base.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qnn/lowlevel_qnn_qiskit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qnn/qnnc.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qnn/qnnr.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qnn/training.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qrc/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qrc/base_qrc.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/qrc/qrc_regressor.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/data_preprocessing.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/execution/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/execution/automatic_backend_selection.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/execution/hqaa/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/execution/hqaa/heuristic.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/execution/hqaa/parser.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/execution/parallel_estimator.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/execution/parallel_sampler.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/optree/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/optree/optree.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/optree/optree_derivative.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/pennylane/__init__.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/pennylane/pennylane_gates.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/src/squlearn/util/qfi.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/encoding_circuit/test_layered_encoding_circuit.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/encoding_circuit/test_random_encoding_circuits.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/kernel/matrix/test_kernel_optimizer.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/kernel/matrix/test_projected_quantum_kernel.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/kernel/ml/test_qgpc.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/kernel/ml/test_qgpr.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/kernel/ml/test_qkrr.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/kernel/ml/test_qsvc.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/kernel/ml/test_qsvr.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/optimizers/test_sglbo.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/qnn/test_base_qnn.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/qnn/test_qnnc.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/qnn/test_qnnr.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/qnn/test_training.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/qrc/test_base_qrc.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/qrc/test_qrc_classifier.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/qrc/test_qrc_regressor.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/util/execution/test_automatic_backend_selection.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/util/execution/test_parallel_primitives.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/util/optree/test_optree_derivative.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/util/optree/test_optree_evaluate.py +0 -0
- {squlearn-0.8.0 → squlearn-0.8.1}/tests/util/test_executor.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: squlearn
|
|
3
|
-
Version: 0.8.
|
|
4
|
-
Summary: A library for quantum machine learning following the scikit-
|
|
3
|
+
Version: 0.8.1
|
|
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>
|
|
@@ -58,10 +58,10 @@ Provides-Extra: examples
|
|
|
58
58
|
|
|
59
59
|
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
60
|
|
|
61
|
-
sQUlearn offers scikit-learn compatible high-level interfaces for various kernel methods and
|
|
61
|
+
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
62
|
|
|
63
63
|
<p align="center">
|
|
64
|
-
<img width=
|
|
64
|
+
<img width=600px alt="sQUlearn schematic" src="https://raw.githubusercontent.com/sQUlearn/squlearn/main/docs/_static/schematic.png" />
|
|
65
65
|
</p>
|
|
66
66
|
|
|
67
67
|
---
|
|
@@ -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
|
}
|
|
@@ -50,6 +50,21 @@ 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.
|
|
67
|
+
|
|
53
68
|
|
|
54
69
|
.. currentmodule:: squlearn.kernel.ml
|
|
55
70
|
|
|
@@ -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
|
|
@@ -292,13 +292,13 @@ The noise level of the model thus depends on its variance, which can be calculat
|
|
|
292
292
|
\sigma_f^2 = \langle\Psi\lvert\hat{C}^2\rvert\Psi\rangle -
|
|
293
293
|
\langle\Psi\lvert\hat{C}\rvert\Psi\rangle^2 \text{.}
|
|
294
294
|
|
|
295
|
-
`
|
|
295
|
+
`Figure_qnn 3`_ shows the output of a :class:`QNNRegressor` fit to a logarithm
|
|
296
296
|
with :class:`SquaredLoss <squlearn.qnn.loss.SquaredLoss>` evaluated on Qiskit's
|
|
297
297
|
:class:`QasmSimulator <qiskit_aer.QasmSimulator>`.
|
|
298
298
|
The model has been trained with a noise-free simulator, but evaluating it on a noisy simulator
|
|
299
299
|
yields a high variance in the model output.
|
|
300
300
|
|
|
301
|
-
..
|
|
301
|
+
.. _figure_qnn 2:
|
|
302
302
|
.. plot::
|
|
303
303
|
:caption: **Figure 2** Logarithm and output of :class:`QNNRegressor` :math:`f(\theta, x)` evaluated on Qiskit's
|
|
304
304
|
:class:`QasmSimulator <qiskit_aer.QasmSimulator>`. The QNN output has a high variance.
|
|
@@ -359,9 +359,9 @@ takes the keyword argument ``iteration`` to dynamically adjust the factor. Value
|
|
|
359
359
|
:math:`10^{-2}` and :math:`10^{-4}` have shown to yield satisfying results. `[1]`_
|
|
360
360
|
|
|
361
361
|
Evaluation on Qiskit's :class:`QasmSimulator <qiskit_aer.QasmSimulator>` now yields less variance
|
|
362
|
-
in the model, as depicted in `
|
|
362
|
+
in the model, as depicted in `figure_qnn 3`_.
|
|
363
363
|
|
|
364
|
-
..
|
|
364
|
+
.. _figure_qnn 3:
|
|
365
365
|
.. plot::
|
|
366
366
|
:caption: **Figure 3** Logarithm and output of :class:`QNNRegressor` :math:`f(\theta, x)`, trained with variance
|
|
367
367
|
regularization, evaluated on Qiskit's :class:`QasmSimulator <qiskit_aer.QasmSimulator>`.
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
.. _quantum_reservoir_computing:
|
|
2
|
+
|
|
3
|
+
.. currentmodule:: squlearn.qrc
|
|
4
|
+
|
|
5
|
+
===========================
|
|
6
|
+
Quantum Reservoir Computing
|
|
7
|
+
===========================
|
|
8
|
+
|
|
9
|
+
Reservoir Computing (RC) in general leverages a fixed, randomly connected network structure called the 'reservoir.'
|
|
10
|
+
This is in strong contrast to conventional deep learning architectures, which performe the optimization of weight across all layers.
|
|
11
|
+
In RC, the reservoir enables dynamic, nonlinear transformations of input data into a high-dimensional feature space, followed by linear regression to produce the output.
|
|
12
|
+
Quantum Reservoir Computing (QRC) tries to take advantage of the exponential scaling dimension of the Hilbert space in the quantum computing context
|
|
13
|
+
to potentially provide an advantage over the classical RC. In QRC there is a register of accessable qubits :math:`\rho_0`, which are subject to
|
|
14
|
+
encoding the classical information and measurements, and hidden qubits :math:`\rho_{\mathrm{hid}}`, which are related to the reservoir and
|
|
15
|
+
artifically raise the dimension, the reservoir dynamic acts on, by the size of the hidden register. The hidden qubits can either be provided by an additional register
|
|
16
|
+
or interaction with the enviroment.
|
|
17
|
+
|
|
18
|
+
First the classical input data :math:`x=\lbrace x^{(i)}\rbrace_{i=1}^D`, where :math:`D` denotes the samplesize, gets related to a unitary
|
|
19
|
+
evolution :math:`U(x)`, called encoding circuit, that evolves the initial state of the accessable qubits :math:`\rho_0` to
|
|
20
|
+
|
|
21
|
+
.. math::
|
|
22
|
+
\rho(x)=U(x)\rho_0U(x)^{\dagger}.
|
|
23
|
+
|
|
24
|
+
Afterwards the reservoir dynamic :math:`U_R` gets applied to the composite of the accessable and hidden qubits, i.e
|
|
25
|
+
|
|
26
|
+
.. math::
|
|
27
|
+
\tilde{\rho}(x)=U_R(\rho(x)\otimes \rho_{\mathrm{hid}})U_R^{\dagger}=U_R(U(x)\rho_0U(x)^{\dagger}\otimes \rho_{\mathrm{hid}})U_R^{\dagger}.
|
|
28
|
+
|
|
29
|
+
Now using a set of (usually randomized) observables :math:`\lbrace O_1, \ldots, O_M \rbrace` the respective expecation-
|
|
30
|
+
values
|
|
31
|
+
|
|
32
|
+
.. math::
|
|
33
|
+
\langle O_j \rangle_x = \mathrm{Tr}(O_j \tilde{\rho}(x))
|
|
34
|
+
|
|
35
|
+
are deteremined by measurements for all :math:`j = 1 ,\ldots,M`. The resulting vector
|
|
36
|
+
|
|
37
|
+
.. math::
|
|
38
|
+
\symbf{v}(x):= \begin{bmatrix}\langle O_1 \rangle_x\\\vdots\\\langle O_M \rangle_x\end{bmatrix}
|
|
39
|
+
|
|
40
|
+
can be used to perform classical machine learning algorithms like linear regression. So the key advantage over QNN is
|
|
41
|
+
that one does not optimize over the weights of a complex parametrized quantum circuit, but keeps the complex part fix and later
|
|
42
|
+
optimizes the readout vectors via cheaper algorithms.
|
|
43
|
+
|
|
44
|
+
.. _figure_qrc 1:
|
|
45
|
+
.. figure:: ../_static/qrc/QRC_user_guide.png
|
|
46
|
+
:alt: Quantum Reservoir Computing (QRC)
|
|
47
|
+
:width: 600
|
|
48
|
+
:align: center
|
|
49
|
+
|
|
50
|
+
**Figure 1** An example of a quantum reservoir computing circuit (see Ref. [1]). In the graphic we set the hidden qubits :math:`\rho_{\mathrm{hid}}` as :math:`\ket{000}`.
|
|
51
|
+
The encoding circuit (orange) and the quantum reservoir (blue) evolve the initial accessable qubit register :math:`\ket{\rho_0}` and
|
|
52
|
+
the composite of accessable and hidden qubits respectively. After the measurement with respect to the observable :math:`O_k` we can
|
|
53
|
+
repeat with similar circuits for all the other observables and use the expectation values to do classical machine learning.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
Note that in sQUlearn, there is no hidden qubit register available in the pre-configured encoding circuits. This can be constructed manually if needed, or if run on a
|
|
58
|
+
quantum computer, it may be due to the (non-controllable) interaction with the surrounding bath.
|
|
59
|
+
|
|
60
|
+
With the outputs of our QRC circuit we construct the so called readout vector
|
|
61
|
+
|
|
62
|
+
.. math::
|
|
63
|
+
\symbf{v}^*(x)= \symbf{w}^\top \symbf{v}(x) = \sum\limits^M_{j=1} \symrm{w}_j \cdot \langle O_j \rangle_x,
|
|
64
|
+
|
|
65
|
+
where :math:`\symbf{w}^\top = (\symrm{w}_1, \ldots, \symrm{w}_M)`, and the task of classical maschine learning is to determine the best collection of weights :math:`\symrm{w}_j`. This can
|
|
66
|
+
be done, for example, using a pseudo inverse method.
|
|
67
|
+
|
|
68
|
+
High-level methods for QRC
|
|
69
|
+
===========================
|
|
70
|
+
|
|
71
|
+
As already mentioned the expectation values :math:`\langle O_j \rangle_x` will be used to carry out a classical maschine learning model. Usually one sticks to linear
|
|
72
|
+
regression, since the complexity is transmitted to the reservoir. Nonetheless sQUlearn provides some additional options to choose from.
|
|
73
|
+
|
|
74
|
+
With sQUlearn it is possible to use QRC to do regression and classification tasks:
|
|
75
|
+
|
|
76
|
+
.. autosummary::
|
|
77
|
+
:nosignatures:
|
|
78
|
+
|
|
79
|
+
QRCClassifier
|
|
80
|
+
QRCRegressor
|
|
81
|
+
|
|
82
|
+
By passing either of both classes a fitting keyword argument ``mlp`` (multi-layer perceptron model), ``linear`` (linear model or single layer perceptron for classification) or
|
|
83
|
+
``kernel`` (support vector maschine) one can set the desired maschine learning model.
|
|
84
|
+
We will now go step by step through the implementation of an example QRC for both methods with sQUlearn.
|
|
85
|
+
|
|
86
|
+
Classification
|
|
87
|
+
===============
|
|
88
|
+
|
|
89
|
+
Setup
|
|
90
|
+
-----
|
|
91
|
+
|
|
92
|
+
First an foremost the encoding of the classical data onto the accessable qubits and the quantum reservoir preparation
|
|
93
|
+
is done in sQUlearn by the :class:`EncodingCircuit` class. For details we refer to the documentations and examples in the user guidelines.
|
|
94
|
+
|
|
95
|
+
.. jupyter-execute::
|
|
96
|
+
|
|
97
|
+
from squlearn.encoding_circuit import ChebyshevPQC
|
|
98
|
+
|
|
99
|
+
pqc = ChebyshevPQC(num_qubits=8, num_features=2, num_layers=2)
|
|
100
|
+
pqc.draw("mpl")
|
|
101
|
+
|
|
102
|
+
Here we have chosen the :class:`~squlearn.encoding_circuit.ChebyshevPQC` as our encoding circuit, but sQUlearn provides a list of several alternative choices in :ref:`quantum_encoding_circuits`.
|
|
103
|
+
The parameters are all randomly chosen. Next we also initialize our executor and QRCClassifier:
|
|
104
|
+
|
|
105
|
+
.. code-block:: python
|
|
106
|
+
|
|
107
|
+
from squlearn import Executor
|
|
108
|
+
from squlearn.qrc.qrc_classifier import QRCClassifier
|
|
109
|
+
|
|
110
|
+
exec = Executor()
|
|
111
|
+
qrc = QRCClassifier(pqc, executor=exec, ml_model="linear", num_operators=200)
|
|
112
|
+
|
|
113
|
+
The :class:`QRCClassifier` takes our prepared :class:`EncodingCircuit` and a machine learning method of our choice with
|
|
114
|
+
linear regression as the default setting. In the last argument we can set the number of observables :math:`M`, which will be randomly chosen in
|
|
115
|
+
order to measure the circuit and create the output vector :math:`\vec{v}` of size :math:`M`. For closer instructions on the
|
|
116
|
+
:class:`Executor` class we refer to :ref:`executor_user_guide` in the user guideline.
|
|
117
|
+
|
|
118
|
+
Training
|
|
119
|
+
--------
|
|
120
|
+
|
|
121
|
+
Now we train our QRC model using the :class:`fit` method after we specify a certain dataset we like to train on:
|
|
122
|
+
|
|
123
|
+
.. code-block:: python
|
|
124
|
+
|
|
125
|
+
from sklearn.datasets import make_moons
|
|
126
|
+
from sklearn.model_selection import train_test_split
|
|
127
|
+
from sklearn.preprocessing import MinMaxScaler
|
|
128
|
+
|
|
129
|
+
X, y = make_moons(n_samples=1000, noise=0.2, random_state=42)
|
|
130
|
+
|
|
131
|
+
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
|
|
132
|
+
|
|
133
|
+
scaler = MinMaxScaler(feature_range=(-0.9, 0.9))
|
|
134
|
+
X_train = scaler.fit_transform(X_train)
|
|
135
|
+
X_test = scaler.transform(X_test)
|
|
136
|
+
|
|
137
|
+
qrc.fit(X_train, y_train)
|
|
138
|
+
|
|
139
|
+
Result
|
|
140
|
+
------
|
|
141
|
+
|
|
142
|
+
In the end we can plot our results and see how it worked:
|
|
143
|
+
|
|
144
|
+
.. code-block:: python
|
|
145
|
+
|
|
146
|
+
import numpy as np
|
|
147
|
+
import matplotlib.pyplot as plt
|
|
148
|
+
|
|
149
|
+
xx, yy = np.meshgrid(np.linspace(-1, 1, 50), np.linspace(-1, 1, 50))
|
|
150
|
+
Z = qrc.predict(np.c_[xx.ravel(), yy.ravel()])
|
|
151
|
+
Z = Z.reshape(xx.shape)
|
|
152
|
+
|
|
153
|
+
plt.contourf(xx, yy, Z, alpha=0.8)
|
|
154
|
+
plt.scatter(
|
|
155
|
+
X_train[:, 0], X_train[:, 1], c=y_train, edgecolor="k", marker="X", label="Training Data"
|
|
156
|
+
)
|
|
157
|
+
plt.scatter(X_test[:, 0], X_test[:, 1], c=y_test, edgecolor="k", marker="o", label="Test Data")
|
|
158
|
+
plt.xlabel("Feature 1")
|
|
159
|
+
plt.ylabel("Feature 2")
|
|
160
|
+
plt.title("QRC Classification Inference")
|
|
161
|
+
plt.legend()
|
|
162
|
+
plt.show()
|
|
163
|
+
|
|
164
|
+
.. _figure_qrc 2:
|
|
165
|
+
.. figure:: ../_static/qrc/qrc_classification_transparent.png
|
|
166
|
+
:alt: Classification
|
|
167
|
+
:width: 600
|
|
168
|
+
:align: center
|
|
169
|
+
|
|
170
|
+
**Figure 2** One can see that on this particular case the classification was very successful.
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
Regression
|
|
174
|
+
==========
|
|
175
|
+
|
|
176
|
+
Setup
|
|
177
|
+
-----
|
|
178
|
+
|
|
179
|
+
Just like in the classifier example we start by encoding the classical data and reservoir with the :class:`_encoding_circuit` class.
|
|
180
|
+
This time, we choose the :class:`~squlearn.encoding_circuit.HubregtsenEncodingCircuit` as our encoding circuit, again with randomly picked parameters.
|
|
181
|
+
|
|
182
|
+
.. jupyter-execute::
|
|
183
|
+
|
|
184
|
+
from squlearn.encoding_circuit import HubregtsenEncodingCircuit
|
|
185
|
+
|
|
186
|
+
pqc = HubregtsenEncodingCircuit(num_qubits=10, num_features=1, num_layers=2)
|
|
187
|
+
pqc.draw("mpl")
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
The :class:`QRCRegressor` similar to the classifier example, takes our prepared :class:`EncodingCircuit` and a machine learning method
|
|
191
|
+
of our choice with linear regression as the default setting. In the last argument we again can determine the number of observables :math:`M`
|
|
192
|
+
to measure the circuit and create the output vector :math:`\vec{v}` of size :math:`M`.
|
|
193
|
+
|
|
194
|
+
.. code-block:: python
|
|
195
|
+
|
|
196
|
+
from squlearn import Executor
|
|
197
|
+
from squlearn.qrc import QRCRegressor
|
|
198
|
+
|
|
199
|
+
exec = Executor()
|
|
200
|
+
qrc = QRCRegressor(pqc, executor=exec, ml_model="linear", num_operators=200)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
Training
|
|
204
|
+
--------
|
|
205
|
+
|
|
206
|
+
.. code-block:: python
|
|
207
|
+
|
|
208
|
+
import numpy as np
|
|
209
|
+
|
|
210
|
+
X_train = np.arange(0.0, 1.0, 0.1)
|
|
211
|
+
y_train = np.exp(np.sin(10 * X_train))
|
|
212
|
+
X_train = X_train.reshape(-1, 1)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
X_test = np.arange(0.01, 1.0, 0.01)
|
|
216
|
+
y_test = np.exp(np.sin(10 * X_test))
|
|
217
|
+
X_test = X_test.reshape(-1, 1)
|
|
218
|
+
|
|
219
|
+
qrc.fit(X_train, y_train)
|
|
220
|
+
|
|
221
|
+
Now we evaluate the model by calculating the inference of the model and the training data set
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
.. code-block:: python
|
|
225
|
+
|
|
226
|
+
y_pred = qrc.predict(X_test)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
Result
|
|
230
|
+
------
|
|
231
|
+
|
|
232
|
+
.. code-block:: python
|
|
233
|
+
|
|
234
|
+
import matplotlib.pyplot as plt
|
|
235
|
+
from sklearn.metrics import mean_squared_error, r2_score
|
|
236
|
+
|
|
237
|
+
print("Mean Squared Error:", mean_squared_error(y_test, y_pred))
|
|
238
|
+
print("R^2 Score:", r2_score(y_test, y_pred))
|
|
239
|
+
|
|
240
|
+
plt.plot(X_test, y_test, "-", color="blue", label="True Values")
|
|
241
|
+
plt.plot(X_test, y_pred, "-", color="red", label="Predictions")
|
|
242
|
+
plt.plot(X_train, y_train, "x", color="green", label="Training Set")
|
|
243
|
+
plt.xlabel("x")
|
|
244
|
+
plt.ylabel("f(x)")
|
|
245
|
+
plt.title("QRC Regression Inference")
|
|
246
|
+
plt.legend()
|
|
247
|
+
plt.show()
|
|
248
|
+
|
|
249
|
+
.. _figure_qrc 3:
|
|
250
|
+
.. figure:: ../_static/qrc/qrc_regression_transparent.png
|
|
251
|
+
:alt: Regression
|
|
252
|
+
:width: 600
|
|
253
|
+
:align: center
|
|
254
|
+
|
|
255
|
+
**Figure 3** The regression of our discrete data set fits the function locally with high precision.
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
.. rubric:: References
|
|
259
|
+
|
|
260
|
+
_`[1]` Xiong, Weijie, et al. "On fundamental aspects of quantum extreme learning machines"
|
|
261
|
+
`arXiv:2312.15124 <https://arxiv.org/abs/2312.15124>`_ (2023).
|
|
262
|
+
|
|
263
|
+
_`[2]` Suzuki, Y., Gao, Q., Pradel, K.C. et al. "Natural quantum reservoir computing for temporal information processing"
|
|
264
|
+
`Sci Rep 12, 1353 <https://doi.org/10.1038/s41598-022-05061-w>`_ (2022).
|