Skip to content

Commit 100df20

Browse files
Merge pull request #302 from sQUlearn/develop
Release 0.8.0
2 parents 6cb15f3 + 5d65b75 commit 100df20

103 files changed

Lines changed: 10258 additions & 1790 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/doc_checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ jobs:
1616
- uses: sQUlearn/sphinx-action@master
1717
with:
1818
docs-folder: "docs/"
19-
pre-build-command: "pip3 install ."
19+
pre-build-command: "pip3 install .[docs]"
2020
build-command: "sphinx-build -b html . _build -W --keep-going"

.github/workflows/publish_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: sQUlearn/sphinx-action@master
2525
with:
2626
docs-folder: "docs/"
27-
pre-build-command: "pip3 install ."
27+
pre-build-command: "pip3 install .[docs]"
2828
build-command: "sphinx-build -b html . _build -W"
2929
- name: Commit Files
3030
run: |

.github/workflows/tests.yaml

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,120 @@ on:
55
- cron: '23 1 * * *'
66

77
jobs:
8-
pytest:
8+
pytest_minimal_requirements:
99
runs-on: ubuntu-latest
1010

1111
steps:
1212
- uses: actions/checkout@v4
1313
- name: Set up Python
14-
uses: actions/setup-python@v4
14+
uses: actions/setup-python@v5
1515
with:
1616
python-version: '3.9'
1717
- name: Install dependencies
1818
run: |
1919
python -m pip install --upgrade pip
20+
python -m venv venv_minimal
21+
source venv_minimal/bin/activate
22+
pip install toml
23+
python3 install_lowest_dependencies.py
24+
- name: Test with pytest
25+
run: |
26+
source venv_minimal/bin/activate
27+
pip install pytest
28+
pytest tests/
29+
- name: Test examples
30+
run: |
31+
source venv_minimal/bin/activate
32+
pip install nbmake
33+
pytest --nbmake --nbmake-timeout 600 examples/
34+
- name: clean
35+
run: |
36+
rm -rf venv_minimal
37+
38+
pytest_qiskit_0_46:
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- uses: actions/checkout@v4
43+
- name: Set up Python
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: '3.9'
47+
- name: Install dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
python -m venv venv_qiskit_0_46
51+
source venv_qiskit_0_46/bin/activate
52+
pip install .[examples] qiskit==0.46.3 qiskit-ibm-runtime==0.20.0
53+
- name: Test with pytest
54+
run: |
55+
source venv_qiskit_0_46/bin/activate
56+
pip install pytest
57+
pytest tests/
58+
- name: Test examples
59+
run: |
60+
source venv_qiskit_0_46/bin/activate
61+
pip install nbmake
62+
pytest --nbmake --nbmake-timeout 600 examples/
63+
- name: clean
64+
run: |
65+
rm -rf venv_qiskit_0_46
66+
67+
pytest_qiskit_1:
68+
runs-on: ubuntu-latest
69+
70+
steps:
71+
- uses: actions/checkout@v4
72+
- name: Set up Python
73+
uses: actions/setup-python@v5
74+
with:
75+
python-version: '3.9'
76+
- name: Install dependencies
77+
run: |
78+
python -m pip install --upgrade pip
79+
python -m venv venv_qiskit_1
80+
source venv_qiskit_1/bin/activate
81+
pip install .[examples] qiskit==1.1.2 qiskit-ibm-runtime==0.27.1
82+
- name: Test with pytest
83+
run: |
84+
source venv_qiskit_1/bin/activate
85+
pip install pytest
86+
pytest tests/
87+
- name: Test examples
88+
run: |
89+
source venv_qiskit_1/bin/activate
90+
pip install nbmake
91+
pytest --nbmake --nbmake-timeout 600 examples/
92+
- name: clean
93+
run: |
94+
rm -rf venv_qiskit_1
95+
96+
pytest_latest:
97+
runs-on: ubuntu-latest
98+
99+
steps:
100+
- uses: actions/checkout@v4
101+
- name: Set up Python
102+
uses: actions/setup-python@v5
103+
with:
104+
python-version: |
105+
3.12
106+
- name: Install dependencies
107+
run: |
108+
python -m pip install --upgrade pip
109+
python -m venv venv_latest
110+
source venv_latest/bin/activate
20111
pip install .[examples]
21112
- name: Test with pytest
22113
run: |
114+
source venv_latest/bin/activate
23115
pip install pytest
24116
pytest tests/
25117
- name: Test examples
26118
run: |
119+
source venv_latest/bin/activate
27120
pip install nbmake
28-
pytest --nbmake --nbmake-timeout 600 examples/
121+
pytest --nbmake --nbmake-timeout 600 examples/
122+
- name: clean
123+
run: |
124+
rm -rf venv_latest

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ examples/qnn/*_log.csv
169169
examples/**/*.log
170170

171171
#Example caches
172-
examples/**/_cache
172+
**/_cache
173173
examples/integration/mlruns
174174

175175
# Genereated doc images

README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img alt="sQUlearn" src="https://raw.githubusercontent.com/sQUlearn/squlearn/main/docs/_static/logo.png" />
33
</p>
44

5-
sQUlearn is a user-friendly, NISQ-ready Python library for quantum machine learning (QML), designed for seamless integration with classical machine learning tools like scikit-learn. The library's dual-layer architecture serves both QML researchers and practitioners, enabling efficient prototyping, experimentation, and pipelining. sQUlearn provides a comprehensive toolset that includes both quantum kernel methods and quantum neural networks, along with features like customizable data encoding strategies, automated execution handling, and specialized kernel regularization techniques. By focusing on NISQ-compatibility and end-to-end automation, sQUlearn aims to bridge the gap between current quantum computing capabilities and practical machine learning applications.
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.
66

77
sQUlearn offers scikit-learn compatible high-level interfaces for various kernel methods and QNNs. They build on top of the low-level interfaces of the QNN engine and the quantum kernel engine. The executor is used to run experiments on simulated and real backends of the Qiskit or PennyLane frameworks.
88

@@ -39,7 +39,7 @@ pip install .[examples]
3939
```
4040

4141
## Contribute to sQUlearn
42-
Thanks for considering to contribute to sQUlearn! Please read our [contribution guidelines](https://github.com/sQUlearn/squlearn/blob/main/.github/CONTRIBUTING.md) before you submit a pull request.
42+
Thanks for considering contributing to sQUlearn! Please read our [contribution guidelines](https://github.com/sQUlearn/squlearn/blob/main/.github/CONTRIBUTING.md) before you submit a pull request.
4343

4444
---
4545
## License
@@ -61,11 +61,6 @@ For general questions regarding sQUlearn, use the [GitHub Discussions](https://g
6161
---
6262
## Acknowledgements
6363

64-
This project was supported by the German Federal Ministry
65-
of Economic Affairs and Climate Action through the
66-
projects AutoQML (grant no. 01MQ22002A) and AQUAS
67-
(grant no. 01MQ22003D), as well as the German Federal
68-
Ministry of Education and Research through the project
69-
H2Giga Degrad-EL3 (grant no. 03HY110D).
64+
This project was supported by the German Federal Ministry of Economic Affairs and Climate Action through the projects AutoQML (grant no. 01MQ22002A) and AQUAS (grant no. 01MQ22003D), as well as the German Federal Ministry of Education and Research through the project H2Giga Degrad-EL3 (grant no. 03HY110D).
7065

71-
---
66+
---

docs/_static/util/executor.png

-55.3 KB
Loading

docs/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ def setup(app):
106106

107107
# intersphinx
108108
intersphinx_mapping = {
109-
"qiskit": ("https://docs.quantum.ibm.com/api/qiskit/", None),
109+
"pennylane": ("https://docs.pennylane.ai/en/stable/", None),
110+
"qiskit": ("https://docs.quantum.ibm.com/api/qiskit/1.1/", None),
110111
"qiskit-aer": ("https://qiskit.github.io/qiskit-aer/", None),
112+
"qiskit-ibm-runtime": ("https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/0.27/", None),
111113
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
112-
"sklearn": ("https://scikit-learn.org/stable/", None),
114+
"sklearn": ("https://scikit-learn.org/1.4/", None),
113115
}
114116

115117
suppress_warnings = ["myst.header", "config.cache"]

docs/install/install.rst

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@ Prerequisites
99
sQUlearn requires a recent python3 (>=3.9) installation.
1010
Additionally the following python packages are necessary: ::
1111

12-
numpy>=1.17
13-
scipy>=1.5
14-
scikit-learn>=1.0
15-
qiskit>=0.42.1
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
1619
qiskit-aer>=0.12.0
17-
qiskit-machine-learning>=0.6.0
18-
qiskit-ibm-runtime>=0.9
19-
dill>=0.3
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
2026

2127
The packages are automatically installed when installing sQUlearn with pip.
2228

@@ -48,3 +54,28 @@ To install the latest development version:
4854
.. code-block:: bash
4955
5056
pip install git+https://github.com/sQUlearn/squlearn.git@develop
57+
58+
59+
60+
Installation with optional dependencies:
61+
----------------------------------------
62+
63+
There are several optional dependencies that can be installed with sQUlearn.
64+
To install sQUlearn with the dependencies usefull for development, run the following command:
65+
66+
.. code-block:: bash
67+
68+
pip install squlearn[dev]
69+
70+
To install sQUlearn with the dependencies necessary to run all examples, run the following command:
71+
72+
.. code-block:: bash
73+
74+
pip install squlearn[examples]
75+
76+
And to install sQUlearn with the dependencies necessary to build the documentation,
77+
run the following command:
78+
79+
.. code-block:: bash
80+
81+
pip install squlearn[docs]

docs/modules/classes.rst

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ QML Regressors
2020
kernel.ml.QKRR
2121
kernel.ml.QGPR
2222
qnn.QNNRegressor
23+
qrc.QRCRegressor
2324

2425

2526
QML Classifiers
@@ -35,7 +36,7 @@ QML Classifiers
3536
kernel.ml.QSVC
3637
kernel.ml.QGPC
3738
qnn.QNNClassifier
38-
39+
qrc.QRCClassifier
3940

4041
Circuit Design
4142
====================================
@@ -64,8 +65,12 @@ Encoding Circuits
6465
encoding_circuit.MultiControlEncodingCircuit
6566
encoding_circuit.ChebyshevRx
6667
encoding_circuit.ParamZFeatureMap
68+
encoding_circuit.KyriienkoEncodingCircuit
6769
encoding_circuit.QiskitEncodingCircuit
6870
encoding_circuit.QCNNEncodingCircuit
71+
encoding_circuit.RandomLayeredEncodingCircuit
72+
encoding_circuit.RandomEncodingCircuit
73+
6974

7075
Encoding Circuit Tools
7176
------------------------------------
@@ -140,6 +145,8 @@ Execution Tools
140145
:template: class.rst
141146

142147
Executor
148+
util.executor.ExecutorEstimator
149+
util.executor.ExecutorSampler
143150

144151

145152
Core
@@ -162,7 +169,7 @@ Quantum Kernel Core
162169
kernel.matrix.FidelityKernel
163170
kernel.matrix.ProjectedQuantumKernel
164171

165-
.. automodule:: squlearn.kernel.optimization
172+
.. automodule:: squlearn.kernel.loss
166173
:no-members:
167174
:no-inherited-members:
168175

@@ -173,9 +180,8 @@ Quantum Kernel Core
173180
:toctree: generated/
174181
:template: class.rst
175182

176-
kernel.optimization.kernel_optimizer.KernelOptimizer
177-
kernel.optimization.negative_log_likelihood.NLL
178-
kernel.optimization.target_alignment.TargetAlignment
183+
kernel.loss.negative_log_likelihood.NLL
184+
kernel.loss.target_alignment.TargetAlignment
179185

180186
QNN Core
181187
------------------------------------
@@ -198,6 +204,7 @@ QNN Core
198204
qnn.lowlevel_qnn_base.LowLevelQNNBase
199205
qnn.loss.SquaredLoss
200206
qnn.loss.VarianceLoss
207+
qnn.loss.ODELoss
201208
qnn.loss.ParameterRegularizationLoss
202209

203210
Tools for training QNNs
@@ -280,11 +287,11 @@ Base Classes
280287
observables.observable_base.ObservableBase
281288
encoding_circuit.encoding_circuit_base.EncodingCircuitBase
282289
kernel.matrix.kernel_matrix_base.KernelMatrixBase
283-
kernel.optimization.kernel_loss_base.KernelLossBase
284-
kernel.optimization.kernel_optimization_base.KernelOptimizerBase
290+
kernel.loss.kernel_loss_base.KernelLossBase
285291
optimizers.optimizer_base.OptimizerBase
286292
qnn.base_qnn.BaseQNN
287293
qnn.loss.LossBase
294+
qrc.base_qrc.BaseQRC
288295

289296

290297

docs/requirements.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)