squlearn 0.8.4__tar.gz → 0.9.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.
Files changed (251) hide show
  1. {squlearn-0.8.4 → squlearn-0.9.0}/.github/workflows/tests.yaml +7 -3
  2. {squlearn-0.8.4 → squlearn-0.9.0}/CITATION.cff +10 -6
  3. {squlearn-0.8.4 → squlearn-0.9.0}/PKG-INFO +9 -5
  4. {squlearn-0.8.4 → squlearn-0.9.0}/README.md +2 -2
  5. squlearn-0.9.0/docs/_static/schematic.png +0 -0
  6. squlearn-0.9.0/docs/_static/util/executor.png +0 -0
  7. {squlearn-0.8.4 → squlearn-0.9.0}/docs/conf.py +2 -2
  8. {squlearn-0.8.4 → squlearn-0.9.0}/docs/install/install.rst +15 -14
  9. {squlearn-0.8.4 → squlearn-0.9.0}/docs/modules/classes.rst +15 -8
  10. {squlearn-0.8.4 → squlearn-0.9.0}/docs/user_guide/encoding_circuits.rst +22 -17
  11. {squlearn-0.8.4 → squlearn-0.9.0}/docs/user_guide/executor.rst +10 -5
  12. {squlearn-0.8.4 → squlearn-0.9.0}/docs/user_guide/kernel_methods.rst +3 -3
  13. {squlearn-0.8.4 → squlearn-0.9.0}/docs/user_guide/observables.rst +6 -1
  14. {squlearn-0.8.4 → squlearn-0.9.0}/docs/user_guide/quantum_neural_networks.rst +39 -7
  15. {squlearn-0.8.4 → squlearn-0.9.0}/docs/user_guide/quantum_reservoir_computing.rst +4 -4
  16. squlearn-0.9.0/examples/encoding_circuits/layered_encoding_circuit.ipynb +179 -0
  17. squlearn-0.9.0/examples/encoding_circuits/pruning_example.ipynb +248 -0
  18. squlearn-0.9.0/examples/encoding_circuits/various_encoding_circuit.ipynb +282 -0
  19. {squlearn-0.8.4 → squlearn-0.9.0}/examples/executor/example_executor_qiskit.ipynb +25 -30
  20. {squlearn-0.8.4 → squlearn-0.9.0}/examples/integration/mlflow.ipynb +6 -9
  21. squlearn-0.9.0/examples/kernel/example_fidelity_kernel.ipynb +184 -0
  22. {squlearn-0.8.4 → squlearn-0.9.0}/examples/kernel/example_projected_kernel.ipynb +12 -28
  23. squlearn-0.9.0/examples/kernel/example_regularization_mitigation.ipynb +387 -0
  24. {squlearn-0.8.4 → squlearn-0.9.0}/examples/kernel/qgpc_workflow.ipynb +9 -16
  25. squlearn-0.9.0/examples/kernel/qgpr_optimization_workflow.ipynb +171 -0
  26. {squlearn-0.8.4 → squlearn-0.9.0}/examples/kernel/qgpr_workflow.ipynb +5 -10
  27. squlearn-0.9.0/examples/qnn/classification_example.ipynb +308 -0
  28. squlearn-0.9.0/examples/qnn/example_adam.ipynb +301 -0
  29. squlearn-0.9.0/examples/qnn/example_minibatch.ipynb +308 -0
  30. squlearn-0.9.0/examples/qnn/example_qcnn_encoding_circuit.ipynb +651 -0
  31. squlearn-0.9.0/examples/qnn/multiclass_classification.ipynb +316 -0
  32. squlearn-0.9.0/examples/qnn/ode_example.ipynb +361 -0
  33. squlearn-0.9.0/examples/qnn/regression_example.ipynb +374 -0
  34. squlearn-0.9.0/examples/qnn/regression_with_variance.ipynb +392 -0
  35. {squlearn-0.8.4 → squlearn-0.9.0}/examples/qrc/qrc_classification.ipynb +8 -117
  36. squlearn-0.9.0/examples/qrc/qrc_regression.ipynb +207 -0
  37. squlearn-0.9.0/examples/tutorials/kernel_digit_classification.ipynb +1061 -0
  38. {squlearn-0.8.4 → squlearn-0.9.0}/examples/tutorials/kernel_grid_search.ipynb +30 -29
  39. {squlearn-0.8.4 → squlearn-0.9.0}/examples/tutorials/kernel_regression.ipynb +6 -13
  40. squlearn-0.9.0/examples/tutorials/qnn_backend_mitigation.ipynb +581 -0
  41. squlearn-0.9.0/examples/tutorials/qnn_ode_solver.ipynb +314 -0
  42. squlearn-0.9.0/examples/tutorials/quantum_bayesian_optimization.ipynb +528 -0
  43. {squlearn-0.8.4 → squlearn-0.9.0}/install_lowest_dependencies.py +19 -3
  44. {squlearn-0.8.4 → squlearn-0.9.0}/pyproject.toml +6 -2
  45. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/__init__.py +1 -1
  46. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/chebyshev_pqc.py +68 -54
  47. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/chebyshev_rx.py +57 -45
  48. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/chebyshev_tower.py +28 -19
  49. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/highdim_encoding_circuit.py +26 -15
  50. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/hubregtsen_encoding_circuit.py +21 -18
  51. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/kyriienko_nonlinear_encoding_circuit.py +19 -10
  52. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/multi_control_encoding_circuit.py +24 -14
  53. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/param_z_feature_map.py +22 -9
  54. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/qcnn_encoding_circuit.py +16 -7
  55. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/random_encoding_circuit.py +58 -20
  56. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/random_layered_encoding_circuit.py +48 -21
  57. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/yz_cx_encoding_circuit.py +16 -8
  58. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/encoding_circuit_base.py +221 -44
  59. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/encoding_circuit_derivatives.py +8 -6
  60. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/layered_encoding_circuit.py +282 -121
  61. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/pruned_encoding_circuit.py +116 -76
  62. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/transpiled_encoding_circuit.py +31 -6
  63. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/lowlevel_kernel/fidelity_kernel.py +102 -80
  64. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/lowlevel_kernel/fidelity_kernel_expectation_value.py +19 -11
  65. squlearn-0.8.4/src/squlearn/kernel/lowlevel_kernel/fidelity_kernel_pennylane.py → squlearn-0.9.0/src/squlearn/kernel/lowlevel_kernel/fidelity_kernel_statevector.py +129 -49
  66. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/lowlevel_kernel/kernel_matrix_base.py +7 -5
  67. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/lowlevel_kernel/kernel_optimizer.py +20 -8
  68. squlearn-0.9.0/src/squlearn/kernel/lowlevel_kernel/kernel_util.py +43 -0
  69. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/lowlevel_kernel/projected_quantum_kernel.py +118 -74
  70. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/qgpc.py +24 -28
  71. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/qgpr.py +15 -7
  72. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/qkrr.py +15 -8
  73. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/qsvc.py +43 -26
  74. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/qsvr.py +46 -26
  75. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/__init__.py +9 -1
  76. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/base_qnn.py +100 -59
  77. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/loss/__init__.py +2 -0
  78. squlearn-0.9.0/src/squlearn/qnn/loss/cross_entropy_loss.py +145 -0
  79. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/loss/squared_loss.py +10 -10
  80. squlearn-0.9.0/src/squlearn/qnn/lowlevel_qnn/evaluation_classes.py +435 -0
  81. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/lowlevel_qnn/lowlevel_qnn.py +36 -5
  82. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/lowlevel_qnn/lowlevel_qnn_base.py +47 -9
  83. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/lowlevel_qnn/lowlevel_qnn_pennylane.py +92 -497
  84. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/lowlevel_qnn/lowlevel_qnn_qiskit.py +27 -15
  85. squlearn-0.9.0/src/squlearn/qnn/lowlevel_qnn/lowlevel_qnn_qulacs.py +487 -0
  86. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/qnnc.py +66 -15
  87. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/qnnr.py +9 -12
  88. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qrc/base_qrc.py +46 -38
  89. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qrc/qrc_classifier.py +1 -1
  90. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qrc/qrc_regressor.py +1 -1
  91. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/data_preprocessing.py +27 -8
  92. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/executor.py +157 -37
  93. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/pennylane/pennylane_circuit.py +15 -24
  94. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/qfi.py +17 -12
  95. squlearn-0.9.0/src/squlearn/util/qulacs/__init__.py +18 -0
  96. squlearn-0.9.0/src/squlearn/util/qulacs/qulacs_circuit.py +833 -0
  97. squlearn-0.9.0/src/squlearn/util/qulacs/qulacs_execution.py +220 -0
  98. squlearn-0.9.0/src/squlearn/util/qulacs/qulacs_gates.py +128 -0
  99. squlearn-0.9.0/src/squlearn/util/serialization/__init__.py +3 -0
  100. squlearn-0.9.0/src/squlearn/util/serialization/model_pickler.py +71 -0
  101. squlearn-0.9.0/src/squlearn/util/serialization/serializable_model_mixin.py +64 -0
  102. squlearn-0.9.0/tests/encoding_circuit/circuit_library/test_chebyshev_pqc.py +135 -0
  103. squlearn-0.9.0/tests/encoding_circuit/circuit_library/test_chebyshev_rx.py +126 -0
  104. squlearn-0.9.0/tests/encoding_circuit/circuit_library/test_chebyshev_tower.py +121 -0
  105. squlearn-0.9.0/tests/encoding_circuit/circuit_library/test_high_dim_encoding_circuit.py +79 -0
  106. squlearn-0.9.0/tests/encoding_circuit/circuit_library/test_hubregtsen_encoding_circuit.py +84 -0
  107. squlearn-0.9.0/tests/encoding_circuit/circuit_library/test_kyriienko_encoding_circuit.py +105 -0
  108. squlearn-0.9.0/tests/encoding_circuit/circuit_library/test_multi_control_encoding_circuit.py +92 -0
  109. squlearn-0.9.0/tests/encoding_circuit/circuit_library/test_param_z_feature_map.py +62 -0
  110. squlearn-0.9.0/tests/encoding_circuit/circuit_library/test_random_encoding_circuit.py +134 -0
  111. squlearn-0.9.0/tests/encoding_circuit/circuit_library/test_random_layered_encoding_circuit.py +157 -0
  112. squlearn-0.9.0/tests/encoding_circuit/circuit_library/test_yz_cx_encoding_circuit.py +78 -0
  113. squlearn-0.9.0/tests/encoding_circuit/test_encoding_circuit_base.py +111 -0
  114. {squlearn-0.8.4 → squlearn-0.9.0}/tests/encoding_circuit/test_layered_encoding_circuit.py +48 -7
  115. squlearn-0.9.0/tests/encoding_circuit/test_pruned_encoding_circuit.py +36 -0
  116. {squlearn-0.8.4 → squlearn-0.9.0}/tests/kernel/matrix/test_fidelity_quantum_kernel.py +4 -4
  117. {squlearn-0.8.4 → squlearn-0.9.0}/tests/kernel/matrix/test_kernel_optimizer.py +23 -15
  118. {squlearn-0.8.4 → squlearn-0.9.0}/tests/kernel/matrix/test_projected_quantum_kernel.py +3 -6
  119. {squlearn-0.8.4 → squlearn-0.9.0}/tests/kernel/ml/test_qgpc.py +73 -2
  120. {squlearn-0.8.4 → squlearn-0.9.0}/tests/kernel/ml/test_qgpr.py +67 -2
  121. {squlearn-0.8.4 → squlearn-0.9.0}/tests/kernel/ml/test_qkrr.py +75 -11
  122. {squlearn-0.8.4 → squlearn-0.9.0}/tests/kernel/ml/test_qsvc.py +76 -5
  123. {squlearn-0.8.4 → squlearn-0.9.0}/tests/kernel/ml/test_qsvr.py +75 -6
  124. squlearn-0.9.0/tests/qnn/lowlevel_qnn/test_lowlevel_qnn.py +65 -0
  125. {squlearn-0.8.4 → squlearn-0.9.0}/tests/qnn/test_base_qnn.py +67 -12
  126. squlearn-0.9.0/tests/qnn/test_loss.py +72 -0
  127. {squlearn-0.8.4 → squlearn-0.9.0}/tests/qnn/test_qnnc.py +62 -23
  128. {squlearn-0.8.4 → squlearn-0.9.0}/tests/qnn/test_qnnr.py +63 -26
  129. {squlearn-0.8.4 → squlearn-0.9.0}/tests/qnn/test_training.py +19 -19
  130. {squlearn-0.8.4 → squlearn-0.9.0}/tests/qrc/test_base_qrc.py +1 -2
  131. {squlearn-0.8.4 → squlearn-0.9.0}/tests/qrc/test_qrc_classifier.py +28 -1
  132. {squlearn-0.8.4 → squlearn-0.9.0}/tests/qrc/test_qrc_regressor.py +27 -0
  133. {squlearn-0.8.4 → squlearn-0.9.0}/tests/util/execution/test_automatic_backend_selection.py +5 -8
  134. squlearn-0.9.0/tests/util/serialization/test_model_pickler.py +86 -0
  135. {squlearn-0.8.4 → squlearn-0.9.0}/tests/util/test_executor.py +63 -3
  136. squlearn-0.8.4/docs/_static/schematic.png +0 -0
  137. squlearn-0.8.4/docs/_static/util/executor.png +0 -0
  138. squlearn-0.8.4/examples/encoding_circuits/layered_encoding_circuit.ipynb +0 -180
  139. squlearn-0.8.4/examples/encoding_circuits/pruning_example.ipynb +0 -261
  140. squlearn-0.8.4/examples/encoding_circuits/various_encoding_circuit.ipynb +0 -277
  141. squlearn-0.8.4/examples/kernel/example_fidelity_kernel.ipynb +0 -189
  142. squlearn-0.8.4/examples/kernel/example_regularization_mitigation.ipynb +0 -387
  143. squlearn-0.8.4/examples/kernel/qgpr_optimization_workflow.ipynb +0 -176
  144. squlearn-0.8.4/examples/qnn/classification_example.ipynb +0 -336
  145. squlearn-0.8.4/examples/qnn/example_adam.ipynb +0 -301
  146. squlearn-0.8.4/examples/qnn/example_minibatch.ipynb +0 -304
  147. squlearn-0.8.4/examples/qnn/example_qcnn_encoding_circuit.ipynb +0 -651
  148. squlearn-0.8.4/examples/qnn/ode_example.ipynb +0 -366
  149. squlearn-0.8.4/examples/qnn/regression_example.ipynb +0 -377
  150. squlearn-0.8.4/examples/qnn/regression_with_variance.ipynb +0 -388
  151. squlearn-0.8.4/examples/qrc/qrc_regression.ipynb +0 -417
  152. squlearn-0.8.4/examples/tutorials/kernel_digit_classification.ipynb +0 -1061
  153. squlearn-0.8.4/examples/tutorials/qnn_backend_mitigation.ipynb +0 -554
  154. squlearn-0.8.4/examples/tutorials/qnn_ode_solver.ipynb +0 -303
  155. squlearn-0.8.4/examples/tutorials/quantum_bayesian_optimization.ipynb +0 -528
  156. squlearn-0.8.4/src/squlearn/kernel/lowlevel_kernel/kernel_util.py +0 -42
  157. squlearn-0.8.4/tests/encoding_circuit/test_random_encoding_circuits.py +0 -114
  158. {squlearn-0.8.4 → squlearn-0.9.0}/.github/CODE_OF_CONDUCT.md +0 -0
  159. {squlearn-0.8.4 → squlearn-0.9.0}/.github/CONTRIBUTING.md +0 -0
  160. {squlearn-0.8.4 → squlearn-0.9.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  161. {squlearn-0.8.4 → squlearn-0.9.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  162. {squlearn-0.8.4 → squlearn-0.9.0}/.github/workflows/doc_checks.yml +0 -0
  163. {squlearn-0.8.4 → squlearn-0.9.0}/.github/workflows/format.yml +0 -0
  164. {squlearn-0.8.4 → squlearn-0.9.0}/.github/workflows/publish.yml +0 -0
  165. {squlearn-0.8.4 → squlearn-0.9.0}/.github/workflows/publish_docs.yml +0 -0
  166. {squlearn-0.8.4 → squlearn-0.9.0}/.gitignore +0 -0
  167. {squlearn-0.8.4 → squlearn-0.9.0}/LICENSE.txt +0 -0
  168. {squlearn-0.8.4 → squlearn-0.9.0}/docs/Makefile +0 -0
  169. {squlearn-0.8.4 → squlearn-0.9.0}/docs/README.md +0 -0
  170. {squlearn-0.8.4 → squlearn-0.9.0}/docs/_static/css/custom.css +0 -0
  171. {squlearn-0.8.4 → squlearn-0.9.0}/docs/_static/favicon.png +0 -0
  172. {squlearn-0.8.4 → squlearn-0.9.0}/docs/_static/logo.png +0 -0
  173. {squlearn-0.8.4 → squlearn-0.9.0}/docs/_static/qkm/QKM_scheme_pic.jpg +0 -0
  174. {squlearn-0.8.4 → squlearn-0.9.0}/docs/_static/qnn/qnn.svg +0 -0
  175. {squlearn-0.8.4 → squlearn-0.9.0}/docs/_static/qrc/QRC_user_guide.png +0 -0
  176. {squlearn-0.8.4 → squlearn-0.9.0}/docs/_static/qrc/qrc_classification_transparent.png +0 -0
  177. {squlearn-0.8.4 → squlearn-0.9.0}/docs/_static/qrc/qrc_regression_transparent.png +0 -0
  178. {squlearn-0.8.4 → squlearn-0.9.0}/docs/_templates/class.rst +0 -0
  179. {squlearn-0.8.4 → squlearn-0.9.0}/docs/_templates/class_with_call.rst +0 -0
  180. {squlearn-0.8.4 → squlearn-0.9.0}/docs/_templates/function.rst +0 -0
  181. {squlearn-0.8.4 → squlearn-0.9.0}/docs/examples/example_kernel_digit_classification.nblink +0 -0
  182. {squlearn-0.8.4 → squlearn-0.9.0}/docs/examples/example_kernel_grid_search.nblink +0 -0
  183. {squlearn-0.8.4 → squlearn-0.9.0}/docs/examples/example_qnn_backend_mitigation.nblink +0 -0
  184. {squlearn-0.8.4 → squlearn-0.9.0}/docs/examples/example_qnn_ode_solver.nblink +0 -0
  185. {squlearn-0.8.4 → squlearn-0.9.0}/docs/examples/example_quantum_bayesian_optimization.nblink +0 -0
  186. {squlearn-0.8.4 → squlearn-0.9.0}/docs/examples/examples_index.rst +0 -0
  187. {squlearn-0.8.4 → squlearn-0.9.0}/docs/index.rst +0 -0
  188. {squlearn-0.8.4 → squlearn-0.9.0}/docs/make.bat +0 -0
  189. {squlearn-0.8.4 → squlearn-0.9.0}/docs/qiskit_settings.conf +0 -0
  190. {squlearn-0.8.4 → squlearn-0.9.0}/docs/spelling_wordlist.txt +0 -0
  191. {squlearn-0.8.4 → squlearn-0.9.0}/docs/user_guide/user_guide_index.rst +0 -0
  192. {squlearn-0.8.4 → squlearn-0.9.0}/examples/tutorials/images/QNN_ode_workflow.png +0 -0
  193. {squlearn-0.8.4 → squlearn-0.9.0}/examples/tutorials/images/encoding_circuit.png +0 -0
  194. {squlearn-0.8.4 → squlearn-0.9.0}/examples/tutorials/images/pipeline.png +0 -0
  195. {squlearn-0.8.4 → squlearn-0.9.0}/examples/tutorials/images/projected_quantum_kernel.png +0 -0
  196. {squlearn-0.8.4 → squlearn-0.9.0}/examples/tutorials/images/quantum_bo.png +0 -0
  197. {squlearn-0.8.4 → squlearn-0.9.0}/output.png +0 -0
  198. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/__init__.py +0 -0
  199. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/__init__.py +0 -0
  200. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/encoding_circuit/circuit_library/qiskit_encoding_circuit.py +0 -0
  201. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/__init__.py +0 -0
  202. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/loss/__init__.py +0 -0
  203. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/loss/kernel_loss_base.py +0 -0
  204. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/loss/negative_log_likelihood.py +0 -0
  205. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/loss/target_alignment.py +0 -0
  206. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/lowlevel_kernel/__init__.py +0 -0
  207. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/kernel/lowlevel_kernel/regularization.py +0 -0
  208. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/observables/__init__.py +0 -0
  209. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/observables/observable_base.py +0 -0
  210. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/observables/observable_derivatives.py +0 -0
  211. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/observables/observable_implemented/__init__.py +0 -0
  212. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/observables/observable_implemented/custom_observable.py +0 -0
  213. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/observables/observable_implemented/ising_hamiltonian.py +0 -0
  214. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/observables/observable_implemented/single_pauli.py +0 -0
  215. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/observables/observable_implemented/single_probability.py +0 -0
  216. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/observables/observable_implemented/summed_paulis.py +0 -0
  217. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/observables/observable_implemented/summed_probabilities.py +0 -0
  218. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/optimizers/__init__.py +0 -0
  219. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/optimizers/adam.py +0 -0
  220. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/optimizers/approximated_gradients.py +0 -0
  221. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/optimizers/optimizer_base.py +0 -0
  222. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/optimizers/optimizers_wrapper.py +0 -0
  223. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/optimizers/sglbo.py +0 -0
  224. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/loss/ode_loss.py +0 -0
  225. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/loss/parameter_regularization_loss.py +0 -0
  226. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/loss/qnn_loss_base.py +0 -0
  227. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/loss/variance_loss.py +0 -0
  228. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/lowlevel_qnn/__init__.py +0 -0
  229. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/util/__init__.py +0 -0
  230. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/util/barren_plateau_analysis.py +0 -0
  231. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qnn/util/training.py +0 -0
  232. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/qrc/__init__.py +0 -0
  233. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/__init__.py +0 -0
  234. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/decompose_to_std.py +0 -0
  235. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/execution/__init__.py +0 -0
  236. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/execution/automatic_backend_selection.py +0 -0
  237. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/execution/hqaa/__init__.py +0 -0
  238. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/execution/hqaa/heuristic.py +0 -0
  239. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/execution/hqaa/parser.py +0 -0
  240. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/execution/parallel_estimator.py +0 -0
  241. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/execution/parallel_sampler.py +0 -0
  242. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/optree/__init__.py +0 -0
  243. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/optree/optree.py +0 -0
  244. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/optree/optree_derivative.py +0 -0
  245. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/optree/optree_evaluate.py +0 -0
  246. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/pennylane/__init__.py +0 -0
  247. {squlearn-0.8.4 → squlearn-0.9.0}/src/squlearn/util/pennylane/pennylane_gates.py +0 -0
  248. {squlearn-0.8.4 → squlearn-0.9.0}/tests/optimizers/test_sglbo.py +0 -0
  249. {squlearn-0.8.4 → squlearn-0.9.0}/tests/util/execution/test_parallel_primitives.py +0 -0
  250. {squlearn-0.8.4 → squlearn-0.9.0}/tests/util/optree/test_optree_derivative.py +0 -0
  251. {squlearn-0.8.4 → squlearn-0.9.0}/tests/util/optree/test_optree_evaluate.py +0 -0
@@ -19,13 +19,17 @@ jobs:
19
19
  python -m pip install --upgrade pip
20
20
  python -m venv venv_minimal
21
21
  source venv_minimal/bin/activate
22
- pip install toml
22
+ pip install toml autoray==0.7.2
23
23
  python3 install_lowest_dependencies.py
24
24
  - name: Test with pytest
25
25
  run: |
26
26
  source venv_minimal/bin/activate
27
27
  pip install pytest
28
28
  pytest tests/
29
+ - name: Install example dependencies
30
+ run: |
31
+ source venv_minimal/bin/activate
32
+ python3 install_lowest_dependencies.py --examples
29
33
  - name: Test examples
30
34
  run: |
31
35
  source venv_minimal/bin/activate
@@ -49,7 +53,7 @@ jobs:
49
53
  python -m pip install --upgrade pip
50
54
  python -m venv venv_qiskit_0_46
51
55
  source venv_qiskit_0_46/bin/activate
52
- pip install .[examples] qiskit==0.46.3 qiskit-ibm-runtime==0.20.0
56
+ pip install .[examples] qiskit==0.46.3 qiskit-ibm-runtime==0.20.0 autoray==0.7.2
53
57
  - name: Test with pytest
54
58
  run: |
55
59
  source venv_qiskit_0_46/bin/activate
@@ -78,7 +82,7 @@ jobs:
78
82
  python -m pip install --upgrade pip
79
83
  python -m venv venv_qiskit_1
80
84
  source venv_qiskit_1/bin/activate
81
- pip install .[examples] qiskit==1.1.2 qiskit-ibm-runtime==0.27.1
85
+ pip install .[examples] qiskit==1.1.2 qiskit-ibm-runtime==0.27.1 autoray==0.7.2
82
86
  - name: Test with pytest
83
87
  run: |
84
88
  source venv_qiskit_1/bin/activate
@@ -8,8 +8,7 @@ license: Apache-2.0
8
8
  repository-code: https://github.com/sQUlearn/squlearn
9
9
  preferred-citation:
10
10
  type: article
11
- status: preprint
12
- title: "sQUlearn - A Python Library for Quantum Machine Learning"
11
+ title: "sQUlearn: A Python Library for Quantum Machine Learning"
13
12
  authors:
14
13
  - family-names: Kreplin
15
14
  given-names: David A.
@@ -35,7 +34,12 @@ preferred-citation:
35
34
  given-names: Marco
36
35
  orcid: https://orcid.org/0000-0002-1276-5655
37
36
  affiliation: Fraunhofer Institute for Manufacturing Engineering and Automation IPA
38
- year: 2023
39
- month: 11
40
- doi: 10.48550/arXiv.2311.08990
41
- url: https://arxiv.org/abs/2311.08990
37
+ journal: "IEEE Software"
38
+ start: 65
39
+ end: 72
40
+ issue: 5
41
+ volume: 42
42
+ year: 2025
43
+ month: 1
44
+ doi: 10.1109/MS.2025.3527736
45
+ url: https://ieeexplore.ieee.org/document/10841386
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: squlearn
3
- Version: 0.8.4
3
+ Version: 0.9.0
4
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>
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  License-File: LICENSE.txt
14
14
  Requires-Dist: bayesian-optimization>=1.4.3,<2
15
- Requires-Dist: dill>=0.3.4
15
+ Requires-Dist: dill>=0.3.5
16
16
  Requires-Dist: mapomatic>=0.10.0
17
17
  Requires-Dist: networkx>=3.0
18
18
  Requires-Dist: numpy>=1.20
@@ -25,6 +25,7 @@ Requires-Dist: qiskit-machine-learning>=0.7.0
25
25
  Requires-Dist: scipy>=1.8.0
26
26
  Requires-Dist: scikit-learn>=1.2.0
27
27
  Requires-Dist: tqdm>=4.1.0
28
+ Requires-Dist: qulacs>=0.6.0
28
29
  Requires-Dist: black ; extra == "dev"
29
30
  Requires-Dist: flit ; extra == "dev"
30
31
  Requires-Dist: nbmake ; extra == "dev"
@@ -41,14 +42,17 @@ Requires-Dist: sphinx ; extra == "docs"
41
42
  Requires-Dist: sphinxcontrib-spelling ; extra == "docs"
42
43
  Requires-Dist: sphinx-rtd-theme<3.0.0 ; extra == "docs"
43
44
  Requires-Dist: sphinx-sitemap ; extra == "docs"
45
+ Requires-Dist: scikit-learn!=1.7.1 ; extra == "docs"
44
46
  Requires-Dist: jupyter ; extra == "examples"
45
47
  Requires-Dist: matplotlib>=3.5.1 ; extra == "examples"
46
48
  Requires-Dist: mlflow ; extra == "examples"
49
+ Requires-Dist: numpy>=1.24.1 ; extra == "examples"
47
50
  Requires-Dist: pandas ; extra == "examples"
48
51
  Requires-Dist: pylatexenc>=2.10 ; extra == "examples"
49
52
  Requires-Dist: seaborn ; extra == "examples"
50
53
  Requires-Dist: scikit-optimize ; extra == "examples"
51
- Project-URL: Homepage, https://github.com/sQUlearn/squlearn
54
+ Project-URL: documentation, https://squlearn.github.io
55
+ Project-URL: github, https://github.com/sQUlearn/squlearn
52
56
  Provides-Extra: dev
53
57
  Provides-Extra: docs
54
58
  Provides-Extra: examples
@@ -59,7 +63,7 @@ Provides-Extra: examples
59
63
 
60
64
  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.
61
65
 
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.
66
+ 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 PennyLane, Qiskit and Qulacs frameworks.
63
67
 
64
68
  <p align="center">
65
69
  <img width=600px alt="sQUlearn schematic" src="https://raw.githubusercontent.com/sQUlearn/squlearn/main/docs/_static/schematic.png" />
@@ -104,7 +108,7 @@ sQUlearn is released under the [Apache License 2.0](https://github.com/sQUlearn/
104
108
  ## Cite sQUlearn
105
109
  If you use sQUlearn in your work, please cite our paper:
106
110
 
107
- > Kreplin, D. A., Willmann, M., Schnabel, J., Rapp, F., Hagelüken, M., & Roth, M. (2023). sQUlearn - A Python Library for Quantum Machine Learning. [https://doi.org/10.48550/arXiv.2311.08990](https://doi.org/10.48550/arXiv.2311.08990)
111
+ > Kreplin, D. A., Willmann, M., Schnabel, J., Rapp, F., Hagelüken, M., & Roth, M. (2025). sQUlearn: A Python Library for Quantum Machine Learning. *IEEE Software, 42*(5), 65–72. [https://doi.org/10.1109/MS.2025.3527736](https://doi.org/10.1109/MS.2025.3527736)
108
112
 
109
113
  ## Contact
110
114
  This project is maintained by the quantum computing group at the Fraunhofer Institute for Manufacturing Engineering and Automation IPA.
@@ -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 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, 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.
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 PennyLane, Qiskit and Qulacs frameworks.
8
8
 
9
9
  <p align="center">
10
10
  <img width=600px alt="sQUlearn schematic" src="https://raw.githubusercontent.com/sQUlearn/squlearn/main/docs/_static/schematic.png" />
@@ -49,7 +49,7 @@ sQUlearn is released under the [Apache License 2.0](https://github.com/sQUlearn/
49
49
  ## Cite sQUlearn
50
50
  If you use sQUlearn in your work, please cite our paper:
51
51
 
52
- > Kreplin, D. A., Willmann, M., Schnabel, J., Rapp, F., Hagelüken, M., & Roth, M. (2023). sQUlearn - A Python Library for Quantum Machine Learning. [https://doi.org/10.48550/arXiv.2311.08990](https://doi.org/10.48550/arXiv.2311.08990)
52
+ > Kreplin, D. A., Willmann, M., Schnabel, J., Rapp, F., Hagelüken, M., & Roth, M. (2025). sQUlearn: A Python Library for Quantum Machine Learning. *IEEE Software, 42*(5), 65–72. [https://doi.org/10.1109/MS.2025.3527736](https://doi.org/10.1109/MS.2025.3527736)
53
53
 
54
54
  ## Contact
55
55
  This project is maintained by the quantum computing group at the Fraunhofer Institute for Manufacturing Engineering and Automation IPA.
@@ -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/", None),
110
+ "qiskit": ("https://quantum.cloud.ibm.com/docs/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/", None),
112
+ "qiskit-ibm-runtime": ("https://quantum.cloud.ibm.com/docs/api/qiskit-ibm-runtime/", None),
113
113
  "scipy": ("https://docs.scipy.org/doc/scipy/", None),
114
114
  "sklearn": ("https://scikit-learn.org/stable/", None),
115
115
  }
@@ -9,20 +9,21 @@ Prerequisites
9
9
  sQUlearn requires a recent python3 (>=3.9) installation.
10
10
  Additionally the following python packages are necessary: ::
11
11
 
12
- bayesian-optimization>=1.4.3,<2
13
- dill>=0.3.4
14
- mapomatic>=0.10.0
15
- networkx>=3.0
16
- numpy>=1.20
17
- pennylane>=0.34.0
18
- qiskit>=0.45.0
19
- qiskit-aer>=0.12.0
20
- qiskit-algorithms>=0.3.0
21
- qiskit-ibm-runtime>=0.18.0
22
- qiskit-machine-learning>=0.7.0
23
- scipy>=1.8.0
24
- scikit-learn>=1.2.0,<1.4.2
25
- tqdm>=4.1.0
12
+ bayesian-optimization>=1.4.3,<2,
13
+ dill>=0.3.4,
14
+ mapomatic>=0.10.0,
15
+ networkx>=3.0,
16
+ numpy>=1.20,
17
+ pennylane>=0.34.0,
18
+ qiskit>=0.45.0,<2,
19
+ qiskit-aer>=0.12.0,
20
+ qiskit-algorithms>=0.3.0,
21
+ qiskit-ibm-runtime>=0.18.0,
22
+ qiskit-machine-learning>=0.7.0,
23
+ scipy>=1.8.0,
24
+ scikit-learn>=1.2.0,
25
+ tqdm>=4.1.0,
26
+ qulacs>=0.6.0,
26
27
 
27
28
  The packages are automatically installed when installing sQUlearn with pip.
28
29
 
@@ -199,11 +199,12 @@ QNN Core
199
199
  :template: class.rst
200
200
 
201
201
  qnn.lowlevel_qnn.LowLevelQNN
202
- qnn.lowlevel_qnn.lowlevel_qnn_qiskit.LowLevelQNNQiskit
203
- qnn.lowlevel_qnn.lowlevel_qnn_qiskit.Expec
204
202
  qnn.lowlevel_qnn.lowlevel_qnn_pennylane.LowLevelQNNPennyLane
203
+ qnn.lowlevel_qnn.lowlevel_qnn_qiskit.LowLevelQNNQiskit
204
+ qnn.lowlevel_qnn.lowlevel_qnn_qulacs.LowLevelQNNQulacs
205
205
  qnn.lowlevel_qnn.lowlevel_qnn_base.LowLevelQNNBase
206
206
  qnn.loss.SquaredLoss
207
+ qnn.loss.CrossEntropyLoss
207
208
  qnn.loss.VarianceLoss
208
209
  qnn.loss.ODELoss
209
210
  qnn.loss.ParameterRegularizationLoss
@@ -274,6 +275,18 @@ PennyLane interface
274
275
 
275
276
  util.pennylane.PennyLaneCircuit
276
277
 
278
+ Qulacs interface
279
+ ------------------------------------
280
+
281
+ .. currentmodule:: squlearn
282
+
283
+ .. autosummary::
284
+ :nosignatures:
285
+ :toctree: generated/
286
+ :template: class.rst
287
+
288
+ util.qulacs.QulacsCircuit
289
+
277
290
 
278
291
  Base Classes
279
292
  ------------------------------------
@@ -293,9 +306,3 @@ Base Classes
293
306
  qnn.base_qnn.BaseQNN
294
307
  qnn.loss.qnn_loss_base.QNNLossBase
295
308
  qrc.base_qrc.BaseQRC
296
-
297
-
298
-
299
-
300
-
301
-
@@ -19,7 +19,7 @@ each gate is applied to all qubits.
19
19
  The package facilitate a fully automated pruning algorithm to remove redundant parameters and
20
20
  enables the automatic differentiation of arbitrary derivative.
21
21
 
22
- The following functions and classes are are accessible via :class:`squlearn.encoding_circuit`.
22
+ The following functions and classes are accessible via :class:`squlearn.encoding_circuit`.
23
23
 
24
24
  Implemented Quantum Encoding Circuits
25
25
  --------------------------------------
@@ -47,8 +47,8 @@ Feel free to contribute to sQUlearn by adding your own encoding circuits in a Pu
47
47
  .. jupyter-execute::
48
48
 
49
49
  from squlearn.encoding_circuit import HubregtsenEncodingCircuit
50
- pqc = HubregtsenEncodingCircuit(num_qubits=4, num_features=2, num_layers=2)
51
- pqc.draw(output="mpl")
50
+ pqc = HubregtsenEncodingCircuit(num_qubits=4, num_layers=2)
51
+ pqc.draw(output="mpl", num_features=2)
52
52
 
53
53
 
54
54
  Combining Quantum Encoding Circuits
@@ -67,11 +67,11 @@ equal to the sum of the parameters in the two original encoding circuits.
67
67
  .. jupyter-execute::
68
68
 
69
69
  from squlearn.encoding_circuit import HubregtsenEncodingCircuit, ChebyshevPQC
70
- fm1 = HubregtsenEncodingCircuit(num_qubits=4, num_features=2, num_layers=1, closed=False)
71
- fm2 = ChebyshevPQC(num_qubits=4, num_features=3, num_layers=1)
70
+ fm1 = HubregtsenEncodingCircuit(num_qubits=4, num_layers=1, closed=False)
71
+ fm2 = ChebyshevPQC(num_qubits=4, num_layers=1)
72
72
  # Combining both encoding circuits
73
73
  fm3 = fm1 + fm2
74
- fm3.draw(output="mpl")
74
+ fm3.draw(output="mpl", num_features=2)
75
75
 
76
76
 
77
77
  Wrapping Qiskit Encoding Circuits
@@ -108,14 +108,14 @@ the :class:`LayeredEncodingCircuit` class.
108
108
 
109
109
  from squlearn.encoding_circuit import LayeredEncodingCircuit
110
110
  from squlearn.encoding_circuit.layered_encoding_circuit import Layer
111
- encoding_circuit = LayeredEncodingCircuit(num_qubits=4,num_features=2)
111
+ encoding_circuit = LayeredEncodingCircuit(num_qubits=4)
112
112
  encoding_circuit.H()
113
113
  layer = Layer(encoding_circuit)
114
114
  layer.Rz("x")
115
115
  layer.Ry("p")
116
116
  layer.cx_entangling("NN")
117
- encoding_circuit.add_layer(layer,num_layers=3)
118
- encoding_circuit.draw(output="mpl")
117
+ encoding_circuit.add_layer(layer, num_layers=3)
118
+ encoding_circuit.draw(output="mpl", num_features=2)
119
119
 
120
120
 
121
121
  **Example: Create your custom layered encoding circuit from a string**
@@ -124,9 +124,9 @@ the :class:`LayeredEncodingCircuit` class.
124
124
 
125
125
  from squlearn.encoding_circuit import LayeredEncodingCircuit
126
126
  encoding_circuit = LayeredEncodingCircuit.from_string(
127
- "Ry(p)-3[Rx(p,x;=y*np.arccos(x),{y,x})-crz(p)]-Ry(p)", num_qubits=4, num_features=1, num_layers=2
127
+ "Ry(p)-3[Rx(p,x;=y*np.arccos(x),{y,x})-crz(p)]-Ry(p)", num_qubits=4, num_layers=2
128
128
  )
129
- encoding_circuit.draw(output="mpl")
129
+ encoding_circuit.draw(output="mpl", num_features=1)
130
130
 
131
131
 
132
132
  Pruning of Quantum Encoding Circuits
@@ -152,6 +152,7 @@ sQUlearn features a fully automated pruning algorithm which can be used by calli
152
152
  from squlearn.encoding_circuit import LayeredEncodingCircuit, automated_pruning
153
153
  from squlearn.util import Executor
154
154
  encoding_circuit = LayeredEncodingCircuit.from_string("Rz(p)-Ry(p)-Z-Ry(p)-Rz(p)", num_qubits=2, num_features=0)
155
+ encoding_circuit._build_layered_pqc(0)
155
156
  pruned_encoding_circuit = automated_pruning(encoding_circuit, Executor())
156
157
  pruned_encoding_circuit.draw(output="mpl")
157
158
 
@@ -184,8 +185,8 @@ is utilized for the arithmetic operations of the derivatives.
184
185
  .. jupyter-execute::
185
186
 
186
187
  from squlearn.encoding_circuit import HubregtsenEncodingCircuit, EncodingCircuitDerivatives
187
- fm = HubregtsenEncodingCircuit(num_qubits=2, num_features=2, num_layers=2)
188
- fm_deriv = EncodingCircuitDerivatives(fm)
188
+ fm = HubregtsenEncodingCircuit(num_qubits=2, num_layers=2)
189
+ fm_deriv = EncodingCircuitDerivatives(fm, num_features=2)
189
190
  # From String (gradient of the parameter vector)
190
191
  grad_from_string = fm_deriv.get_derivative("dp")
191
192
  # From Tuple (second order derivative of the parameter vector; equal to the Hessian)
@@ -202,8 +203,7 @@ To transpile a quantum encoding circuit, you can leverage the functionality prov
202
203
  :class:`TranspiledEncodingCircuit` class. By utilizing this class, you can input an existing
203
204
  quantum encoding circuit and have its circuit transpiled according to the specified backend and
204
205
  transpiler settings, which are the same settings used in Qiskit.
205
- The transpiled encoding circuit is internally employed in the QNN program and projected kernels,
206
- where it is employed internally.
206
+ The transpiled encoding circuit is internally employed in the QNN program and projected kernels.
207
207
 
208
208
  **Example: Transpile a existing Encoding Circuit to a fake backend**
209
209
 
@@ -212,6 +212,11 @@ where it is employed internally.
212
212
  from squlearn.encoding_circuit import TranspiledEncodingCircuit,ChebyshevRx
213
213
  from qiskit_ibm_runtime.fake_provider import FakeManilaV2
214
214
 
215
- fm = TranspiledEncodingCircuit(ChebyshevRx(3,1),backend=FakeManilaV2(),initial_layout=[0,1,4])
216
- fm.draw(output="mpl")
215
+ fm = TranspiledEncodingCircuit(
216
+ ChebyshevRx(3,1),
217
+ backend=FakeManilaV2(),
218
+ num_features=1,
219
+ initial_layout=[0,1,4]
220
+ )
221
+ fm.draw(output="mpl", num_features=1)
217
222
 
@@ -13,7 +13,7 @@ The :class:`Executor <squlearn.Executor>` class is the central component of sQUl
13
13
  for running all quantum jobs.
14
14
  Both high- and low-level methods utilize the :class:`Executor <squlearn.Executor>` class to execute circuits or to run other
15
15
  quantum jobs.
16
- The class provides a high-level interface to the simulators of PennyLane and Qiskit,
16
+ The class provides a high-level interface to the simulators of PennyLane, Qiskit and Qulacs,
17
17
  as well as manages access to real QC hardware as for example IBM Quantum.
18
18
  It features a variety of comfort features, such as result caching,
19
19
  automatic restarts of failed jobs, logging of all actions, and Qiskit Session handling.
@@ -93,7 +93,8 @@ execution environment:
93
93
 
94
94
  - A string specifying the local simulator backend: Qiskit's :class:`AerSimulator <qiskit_aer.AerSimulator>` is available by providing ``"qiskit"``,
95
95
  ``"statevector_simulator"`` and ``"qasm_simulator"``; PennyLane's :class:`DefaultQubit <pennylane.devices.default_qubit.DefaultQubit>` simulator can be initialized by
96
- ``"pennylane"`` or ``"default.qubit"``. Note that with Qiskit version 1.2, the sampler routines will always performe shots for the ``"statevector_simulator"`` keyword.
96
+ ``"pennylane"`` or ``"default.qubit"``. The Qulacs statevector simulator can be used with the keyword ``"qulacs"``.
97
+ Note that with Qiskit version 1.2, the sampler routines will always performe shots for the ``"statevector_simulator"`` keyword.
97
98
 
98
99
  .. jupyter-execute::
99
100
 
@@ -113,6 +114,9 @@ execution environment:
113
114
  # Initialize the Executor with the PennyLane shot-based simulator
114
115
  executor = Executor("default.qubit", shots=1234)
115
116
 
117
+ # Initialize the Executor with the Qulacs statevector simulator
118
+ executor = Executor("qulacs")
119
+
116
120
  - A Qiskit :class:`Backend <qiskit.providers.Backend>`, e.g. a :class:`AerProvider <qiskit_aer.AerProvider>` backend or a :mod:`fake_provider <qiskit_ibm_runtime.fake_provider>` backend. This allows also the utilization
117
121
  of other quantum computing backends, as long as they provide a Qiskit :class:`Backend <qiskit.providers.Backend>` class.
118
122
 
@@ -370,7 +374,7 @@ We set up a small :class:`QNNRegressor <squlearn.qnn.QNNRegressor>` example and
370
374
  backends = [FakeBelemV2(), FakeAthensV2(), FakeManilaV2()]
371
375
  executor = Executor(backends, shots=10000)
372
376
  qnn = QNNRegressor(
373
- ChebyshevPQC(2, 1),
377
+ ChebyshevPQC(2),
374
378
  SummedPaulis(2),
375
379
  executor,
376
380
  SquaredLoss(),
@@ -392,7 +396,7 @@ the mode is switched to ``"speed"``. The :class:`Executor <squlearn.Executor>` i
392
396
  from squlearn import Executor
393
397
  from qiskit_ibm_runtime import QiskitRuntimeService
394
398
  from squlearn.encoding_circuit import ChebyshevRx
395
- from squlearn.kernel import FidelityKernel, QKRR
399
+ from squlearn.kernel.lowlevel_kernel import FidelityKernel, QKRR
396
400
 
397
401
  # Executor is initialized with a service, and considers all available backends
398
402
  # (except simulators)
@@ -400,7 +404,7 @@ the mode is switched to ``"speed"``. The :class:`Executor <squlearn.Executor>` i
400
404
  executor = Executor(service, auto_backend_mode="speed")
401
405
 
402
406
  # Create a QKRR model with a FidelityKernel and the ChebyshevRx encoding circuit
403
- qkrr = QKRR(FidelityKernel(ChebyshevRx(4,1),executor))
407
+ qkrr = QKRR(FidelityKernel(ChebyshevRx(4),executor))
404
408
 
405
409
  # Backend is automatically selected based on the smallest queue
406
410
  # All the following functions will be executed on the selected backend
@@ -455,6 +459,7 @@ circuits that need to be transpiled.
455
459
  * `Qsikit Primitives <https://docs.quantum.ibm.com/api/qiskit/primitives>`_
456
460
  * `Mapomatic: Automatic mapping of compiled circuits to low-noise sub-graphs <https://github.com/qiskit-community/mapomatic>`_
457
461
  * `PennyLane Devices <https://docs.pennylane.ai/en/stable/code/api/pennylane.device.html>`_
462
+ * `Qulacs <http://docs.qulacs.org/en/latest>`_
458
463
 
459
464
  .. rubric:: References
460
465
 
@@ -158,7 +158,7 @@ In sQUlearn a FQK (instance) can be defined as shown by the following example:
158
158
  from squlearn.util import Executor
159
159
  from squlearn.encoding_circuit import ChebyshevPQC
160
160
  from squlearn.kernel import FidelityKernel
161
- enc_circ = ChebyshevPQC(num_qubits=4, num_features=1, num_layers=2)
161
+ enc_circ = ChebyshevPQC(num_qubits=4, num_layers=2)
162
162
  fqk_instance = FidelityKernel(
163
163
  encoding_circuit=enc_circ,
164
164
  executor=Executor()
@@ -211,7 +211,7 @@ the following example:
211
211
  from squlearn.util import Executor
212
212
  from squlearn.encoding_circuit import ChebyshevPQC
213
213
  from squlearn.kernel import ProjectedQuantumKernel
214
- enc_circ = ChebyshevPQC(num_qubits=4, num_features= 1, num_layers=2)
214
+ enc_circ = ChebyshevPQC(num_qubits=4, num_layers=2)
215
215
  pqk_instance = ProjectedQuantumKernel(
216
216
  encoding_circuit=enc_circ,
217
217
  executor=Executor(),
@@ -255,7 +255,7 @@ training and test data and shows how to optimize kernels.
255
255
  from squlearn.kernel.loss import TargetAlignment
256
256
 
257
257
  # set up the encoding circuit
258
- encoding_circuit = ChebyshevPQC(num_qubits=4, num_features=1, num_layers=2)
258
+ encoding_circuit = ChebyshevPQC(num_qubits=4, num_layers=2)
259
259
 
260
260
  # set up the quantum kernel
261
261
  pqk_instance = ProjectedQuantumKernel(encoding_circuit, Executor())
@@ -100,7 +100,12 @@ The map can be for example obtained in the transpiled encoding circuit.
100
100
  from squlearn.encoding_circuit import ChebyshevRx,TranspiledEncodingCircuit
101
101
  from squlearn.observables import SummedPaulis
102
102
  from qiskit_ibm_runtime.fake_provider import FakeManilaV2
103
- fm = TranspiledEncodingCircuit(ChebyshevRx(3,1),backend=FakeManilaV2(),initial_layout=[0,1,4])
103
+ fm = TranspiledEncodingCircuit(
104
+ ChebyshevRx(3,1),
105
+ backend=FakeManilaV2(),
106
+ num_features=1,
107
+ initial_layout=[0,1,4]
108
+ )
104
109
  ob = SummedPaulis(num_qubits=3, op_str="Z")
105
110
  print("Observable before mapping:\n",ob,"\n\n")
106
111
  ob.set_map(fm.qubit_map, fm.num_physical_qubits)
@@ -76,6 +76,37 @@ The specific form of the cost function depends on the problem that the QNN is de
76
76
  For instance, in a regression problem, the cost function is often defined as the mean squared
77
77
  error between the QNN's output and the target value.
78
78
 
79
+ The optimization of a QNN's parameters is typically carried out using gradient-based methods
80
+ such as Adam or SLSQP. The gradients of the cost function with respect to the QNN parameters
81
+ can be computed via the parameter-shift rule (:math:`\alpha \in \{x,y,z\}`):
82
+
83
+ .. math::
84
+
85
+ \frac{d}{dx} \langle \Psi | R_\alpha(\varphi(x)) \hat{C} R_\alpha(\varphi(x)) | \Psi \rangle
86
+ = \tfrac{1}{2} \varphi'(x) \big[ \langle \hat{C}^+ \rangle - \langle \hat{C}^- \rangle \big]
87
+
88
+ where
89
+
90
+ .. math::
91
+
92
+ \langle \hat{C} \rangle^\pm =
93
+ \langle \Psi | R_\alpha(\varphi(x) \pm \tfrac{\pi}{2}) \hat{C}
94
+ R_\alpha(\varphi(x) \pm \tfrac{\pi}{2}) | \Psi \rangle
95
+
96
+ When running the optimization on a statevector simulator, gradients can alternatively
97
+ be computed using automatic differentiation (autodiff) or backpropagation.
98
+ These methods are considerably more efficient than the parameter-shift rule, which is required
99
+ in shot-based simulations or on real quantum hardware. It is important to note that
100
+ autodiff and backpropagation are not applicable on real quantum computers, as the
101
+ no-cloning theorem prevents copying quantum states for reuse in gradient computation.
102
+
103
+ sQUlearn automatically exploits fast gradient evaluation through autodiff for both
104
+ the PennyLane and Qulacs quantum frameworks. PennyLane is the default backend and
105
+ additionally supports the computation of higher-order derivatives. Qulacs, on the other hand,
106
+ is typically much faster than PennyLane for larger circuits, making it the recommended choice
107
+ for most QNN applications. The tutorial below demonstrates how to use Qulacs within sQUlearn.
108
+
109
+
79
110
  High-level methods for QNNs
80
111
  ====================================
81
112
 
@@ -93,8 +124,8 @@ method:
93
124
 
94
125
  from squlearn.encoding_circuit import ChebyshevPQC
95
126
 
96
- pqc = ChebyshevPQC(num_qubits = 4, num_features = 1, num_layers = 2)
97
- pqc.draw("mpl")
127
+ pqc = ChebyshevPQC(num_qubits = 4, num_layers = 2)
128
+ pqc.draw("mpl", num_features = 1)
98
129
 
99
130
  There are several alternative encoding circuits at your disposal in sQUlearn, which you can
100
131
  explore in the user guide located at :ref:`quantum_encoding_circuits`.
@@ -125,7 +156,8 @@ We refer to the documentations and examples of the respective classes for in-dep
125
156
 
126
157
  In the following example we will use a :class:`QNNRegressor`, the encoding circuit, and
127
158
  the observable as defined above. Additionally, we utilize the mean squared error loss function
128
- and the Adam optimizer for optimization.
159
+ and the Adam optimizer for optimization. Furthermore, Qulacs is used as the quantum simulator
160
+ to enable fast gradient calculations.
129
161
 
130
162
  .. code-block:: python
131
163
 
@@ -136,8 +168,8 @@ and the Adam optimizer for optimization.
136
168
  from squlearn import Executor
137
169
 
138
170
  op = SummedPaulis(num_qubits = 4)
139
- pqc = ChebyshevPQC(num_qubits = 4, num_features = 1, num_layers = 2)
140
- qnn = QNNRegressor(pqc, op, Executor(), SquaredLoss(), Adam())
171
+ pqc = ChebyshevPQC(num_qubits = 4, num_layers = 2)
172
+ qnn = QNNRegressor(pqc, op, Executor("qulacs"), SquaredLoss(), Adam())
141
173
 
142
174
  The QNN can be trained utilizing the :meth:`fit <squlearn.qnn.QNNRegressor.fit>` method:
143
175
 
@@ -314,7 +346,7 @@ yields a high variance in the model output.
314
346
  from squlearn.optimizers import SLSQP
315
347
  nqubits = 4
316
348
  number_of_layers = 2
317
- pqc = ChebyshevRx(nqubits, 1, num_layers=number_of_layers)
349
+ pqc = ChebyshevRx(num_qubits=nqubits, num_layers=number_of_layers)
318
350
  exe = Executor("pennylane", seed=0)
319
351
  exe.set_shots(5000)
320
352
  ising_op = IsingHamiltonian(nqubits, I="S", Z="S", ZZ="S")
@@ -379,7 +411,7 @@ in the model, as depicted in `figure_qnn 3`_.
379
411
  from squlearn.optimizers import SLSQP
380
412
  nqubits = 4
381
413
  number_of_layers = 2
382
- pqc = ChebyshevRx(nqubits, 1, num_layers=number_of_layers)
414
+ pqc = ChebyshevRx(num_qubits=nqubits, num_layers=number_of_layers)
383
415
  exe = Executor("qasm_simulator")
384
416
  exe.set_shots(5000)
385
417
  ising_op = IsingHamiltonian(nqubits, I="S", Z="S", ZZ="S")
@@ -96,8 +96,8 @@ is done in sQUlearn by the :class:`EncodingCircuit` class. For details we refer
96
96
 
97
97
  from squlearn.encoding_circuit import ChebyshevPQC
98
98
 
99
- pqc = ChebyshevPQC(num_qubits=8, num_features=2, num_layers=2)
100
- pqc.draw("mpl")
99
+ pqc = ChebyshevPQC(num_qubits=8, num_layers=2)
100
+ pqc.draw("mpl", num_features=2)
101
101
 
102
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
103
  The parameters are all randomly chosen. Next we also initialize our executor and QRCClassifier:
@@ -183,8 +183,8 @@ This time, we choose the :class:`~squlearn.encoding_circuit.HubregtsenEncodingCi
183
183
 
184
184
  from squlearn.encoding_circuit import HubregtsenEncodingCircuit
185
185
 
186
- pqc = HubregtsenEncodingCircuit(num_qubits=10, num_features=1, num_layers=2)
187
- pqc.draw("mpl")
186
+ pqc = HubregtsenEncodingCircuit(num_qubits=10, num_layers=2)
187
+ pqc.draw("mpl", num_features=1)
188
188
 
189
189
 
190
190
  The :class:`QRCRegressor` similar to the classifier example, takes our prepared :class:`EncodingCircuit` and a machine learning method