Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
eda1bfd
adjust the docstrings and the type signature of the fit methods in al…
Aug 14, 2024
ac13d72
removed num_features from the encoding circuits
Aug 20, 2024
e7da024
move the initialization of the low_level_qnn into the fit method
Aug 21, 2024
8424fed
moved neceassary code from the __init__ into the fit for the projecte…
Aug 22, 2024
a70966b
Merge remote-tracking branch 'origin/develop' into remove_num_features
Sep 9, 2024
18d0247
Refactor kernel initialization logic into separate methods
Sep 9, 2024
df8d794
rename "_initialized" to "_is_initialized"
Sep 9, 2024
c27b675
Added method initialize_kernel for the QKRR class, just like for the …
Sep 11, 2024
eade0d9
remove num_features in get_params
Sep 11, 2024
5ff5f9e
rename __initialize_kernel to __initialie in the HLM's
Sep 12, 2024
e0526e9
add num_features as optional parameter for the encoding circuits
Sep 17, 2024
06ee0f3
recheck the initialization in evaluate
Sep 18, 2024
f3f50ab
refactore
Sep 18, 2024
9a7a4ac
add types and docstrings
Sep 19, 2024
2b19a1d
move the initialization of the low level qnn
Sep 19, 2024
147d133
parse array-like inputs in fit into numpy arrays
Oct 1, 2024
a9c3607
fix kernel tests
Oct 4, 2024
ca41c98
fix qnn tests
Oct 4, 2024
dc6c9ff
add EncodingSlotsMismatchError
Oct 4, 2024
8c77ce3
add check for encoding slots in the encoding circuits
Oct 4, 2024
43bf082
add test for encoding slots missmatch
Oct 4, 2024
34be4af
save kwargs in _qnn_params variable
Oct 11, 2024
0c98080
Merge branch 'develop' into remove_num_features
Oct 11, 2024
84dc514
Bug Fix: Avoid generating initial_parameters when a value is already …
Oct 16, 2024
7fbaa5f
wrap the lazy initialization into a single method dependen on num_fea…
Oct 18, 2024
74fd1c6
fix tests
Oct 25, 2024
e9fc676
add num_encoding_slots property and check for violating the max encod…
Oct 25, 2024
06415b1
Merge remote-tracking branch 'origin/develop' into remove_num_features
Oct 25, 2024
5de0b19
set num_features default to None
Oct 25, 2024
8cd979b
Merge branch 'develop' into remove_num_features
MoritzWillmann Oct 27, 2024
dca7155
Merge branch 'develop' into remove_num_features
David-Kreplin Nov 4, 2024
52c73be
fix tests
Nov 7, 2024
3da2126
fix tests
Nov 8, 2024
32bf24a
add tests for automatic num_features selection
Nov 8, 2024
b02bbed
add test for EncodingSlotsMissmatchError
Nov 8, 2024
37283ed
fix docs and examples
Nov 8, 2024
5b9f45d
black
Nov 8, 2024
9e89c37
fix docs
Nov 8, 2024
a6c8ddc
fix example
Nov 8, 2024
8c89681
fix docs
Nov 8, 2024
e34f2c6
fix pennylane QubitDevice import warning
MoritzWillmann Nov 15, 2024
9af34fd
fix test_automatic_backend_selection
Nov 15, 2024
784bdbd
turn test_encoding_slots_mismatch_error into paramerized test
Nov 15, 2024
7d5d2c9
Allow the draw method to draw circuits even if num_features is not pr…
Nov 15, 2024
f502afe
add num_features setter in TranspiledEncodingCircuit
Nov 15, 2024
c8365c9
make QubitDevice import dependant on version
MoritzWillmann Nov 15, 2024
7aa34bc
Add feature consistency check and validation
Nov 22, 2024
e96275a
Merge branch 'remove_num_features' of https://github.com/DennisKleinh…
Nov 22, 2024
c253f9a
moved init code for TranspiledEncodingCircuit in get_circuit method
Dec 13, 2024
ac78947
moved init code of PrunedEncodingCircuit into get_circuit method
Dec 13, 2024
6abf33b
Add num_features property to RandomEncodingCircuit and update config …
Dec 13, 2024
8517be5
Merge branch 'develop' into remove_num_features
MoritzWillmann Dec 13, 2024
6b54c89
Merge branch 'remove_num_features' of https://github.com/DennisKleinh…
Dec 30, 2024
a511a76
move check for encoding_slots in seperate method
Dec 30, 2024
c14523e
add tests for EncodingCircuitBase
Dec 30, 2024
344fcf3
add tests for ChebyshevPQC
Dec 30, 2024
5c6e005
add tests for ChebyshevRx
Dec 30, 2024
de89f02
add tests for ChebyshevTower
Dec 30, 2024
5b56a23
add tests for HighDimEncodingCircuit
Dec 30, 2024
1c602f9
add tests for HubregtsenEncodingCircuit
Dec 30, 2024
ba69fd0
add tests for KyriienkoEncodingCircuit
Dec 30, 2024
7177807
add tests for MultiControlEncodingCircuit
Dec 30, 2024
b4913e7
add tests for ParamZFeatureMap
Dec 30, 2024
3cbc7e0
add tests for YZ_CX_EncodingCircuit
Dec 30, 2024
8aec197
move the random circuit generation into the get_circuit method for th…
Jan 8, 2025
7d6b298
adjust HighDimEncodingCircuit, RandomEncodingCurcuit and RandomLayere…
Jan 9, 2025
04481cc
add tests to ensure the drawing of the circuits does not violate the …
Jan 10, 2025
34b543a
add a minimal fit test to ensure the encoding circuits are working pr…
Jan 10, 2025
611d209
fix tests
Jan 17, 2025
193d484
Ensure qubit mapping is available befor calling get_circuit in Transp…
Jan 17, 2025
ef3291f
Merge branch 'develop' into remove_num_features
MoritzWillmann Jan 17, 2025
37204ec
Merge branch 'develop' into remove_num_features
MoritzWillmann Jan 23, 2025
1a57b64
Merge branch 'develop' into remove_num_features
MoritzWillmann Feb 4, 2025
3c0ba3c
remove the "test_drawing_does_not_violate_params" test from the circu…
Feb 6, 2025
e935bbf
add function to extract the num_features from the input data vector X
Feb 7, 2025
2e22633
remove all references to num_features in the kernels and replace them…
Feb 7, 2025
9cd26b0
remove all references to num_features in the Kernel HLMs and replace …
Feb 7, 2025
cf7cf22
ddjusted any kernel-related changes according to the review
Feb 7, 2025
2984cd9
store the operations for the LayeredEncodingCircuit in a list and app…
Feb 17, 2025
637feca
ensure the random config is availabe before calling generate_initial_…
Feb 18, 2025
08897c4
Remove num_features references in EncodingCircuits
Feb 18, 2025
3634704
adjust tests according to the new feature_bounds
Feb 18, 2025
0e997e1
extract_num_features now supports list input
Feb 19, 2025
396eff8
apply the stored operations in the LayeredEncodingCircuit before call…
Feb 20, 2025
0156720
remove refernces to num_features in the ComposedEncodingCircuit
Feb 20, 2025
24c684d
Merge branch 'develop' into remove_num_features
MoritzWillmann Feb 20, 2025
9e4ffd5
Merge branch 'remove_num_features' of https://github.com/DennisKleinh…
Feb 21, 2025
2380897
fix tests for the Kernel HLMs
Feb 25, 2025
18d62fc
remove num_features for calculating the number of parameters in the P…
Mar 3, 2025
67e0ab7
remove unnecessary references to num_features in the QNNs
Mar 3, 2025
2c623a3
refactor tests for ChebyshevPQC to use parameterized tests for number…
Mar 3, 2025
b041694
refactore docstring for feature_bounds
Mar 3, 2025
3ae44cc
switch from `math.inf` to `np.inf` to omit additional imports
Mar 3, 2025
f9c820b
remove unnecessary imports and duplicate lines
Mar 3, 2025
8a9520b
move the feature consistency check to the `EncodingCircuitBase` class
Mar 3, 2025
53ee19a
Bug fix: num_features was overridden in draw method
Mar 4, 2025
8f19683
moved the feature consistency check into the encoding circuits
Mar 4, 2025
bf334b9
refactored the kernel HLM classes.
Mar 6, 2025
63c97af
Refactor Parameter Handling and Initialization in LayeredEncodingCircuit
Mar 13, 2025
8f4c079
add `num_encoding_slots` Property and a check in `get_circuit`
Mar 13, 2025
f02157a
Refactore RandomEncodingCircuit and RandomLayeredEncodingCircuit
Mar 14, 2025
14ebf6b
Refactor `BaseQNN` and `LowLevelQNNPennyLane` for improved feature ha…
Mar 20, 2025
733ff4c
move ´_initilize_derivative´ to `evaluate` in `LowLevelQNNQiskit`
Mar 21, 2025
3e24a4d
refactore the `Layer` to apply the operations in the `Layer` correctly
Apr 9, 2025
25a204b
moved the `_initialize_parameters` logic into the `fit` method
Apr 15, 2025
bdb50c9
add the `num_encoding_slots` property to the `LayeredEncodingCircuit`
Apr 16, 2025
33690c4
removed reference to the `num_features` property in `QFI`
Apr 24, 2025
5259cf9
refactore `PrunedEncodingCircuit`
Apr 24, 2025
e315d18
add tests for `PrunedEncodingCircuit`
Apr 24, 2025
1eb7ede
refactore `ComposedEncodingCircuit`:
May 6, 2025
af97e63
add `num_encoding_slots` property to `ComposedEncodingCircuit`
May 13, 2025
9c65d30
override the `draw` method in the `ComposedEncodingCircuit` to enable…
May 13, 2025
d66f346
Fix: remove falsly passed argument `num_features` in `QCNNEncodingCir…
May 13, 2025
5e7c3e7
refactore examples to use the correct `EncodingCircuit` signature
May 13, 2025
329586d
adjust docstrings to align with method and class signatures
May 14, 2025
ae394ba
adjust user guids to align with new method und class signatures
May 20, 2025
b26cdf6
Merge branch 'develop' into remove_num_features
DennisKleinhans May 20, 2025
37f3e9b
fix `FideltityKernel` tests
May 20, 2025
4da068f
change `compose` method of `EncodingCircuitBase` to accept also the n…
May 21, 2025
1b2ec8a
fix automatic backend selection tests
May 28, 2025
a5f74d8
fix docs
Jun 17, 2025
341d62b
fix qiskit executor example
MoritzWillmann Jun 18, 2025
b40b4ca
fix doc check warnings
Jun 18, 2025
cd579d8
fix warning in pennylane qnn
MoritzWillmann Jun 18, 2025
e291cec
Merge branch 'develop' into remove_num_features
MoritzWillmann Jun 24, 2025
4f606cf
Merge branch 'develop' into remove_num_features
MoritzWillmann Jun 24, 2025
2fabf79
update sklearn intersphinx
MoritzWillmann Jun 25, 2025
371fbbc
black
MoritzWillmann Jun 25, 2025
4db276d
Merge branch 'develop' into remove_num_features
MoritzWillmann Jun 25, 2025
be88e55
Merge branch 'develop' into remove_num_features
MoritzWillmann Jul 2, 2025
6caa6a4
Merge branch 'develop' into remove_num_features
MoritzWillmann Jul 16, 2025
a86abc5
move code from `_generate_initial_parameters` into `_initialize_kernel`
Jul 22, 2025
66c87db
replaced redundant code by method call
Jul 22, 2025
212089d
removed the grid search example in the docs
Jul 23, 2025
94956ea
inline the collection of the params of the super class
Jul 23, 2025
6a2546e
remove `num_features` in the tests
Jul 23, 2025
612516c
rerun examples
Aug 12, 2025
b52f656
Merge branch 'develop' into remove_num_features
Aug 12, 2025
26597db
adjust the `draw` method to ensure drawing is allways possible
Aug 13, 2025
ae9a439
Improve `_adjust_input` with detailed error messages instead of gener…
Aug 18, 2025
a8fec92
remove failing test
MoritzWillmann Aug 18, 2025
a84bee5
move encoding circuit tests to subfolder
MoritzWillmann Aug 18, 2025
0091107
black tests
MoritzWillmann Aug 18, 2025
856dc84
black examples
MoritzWillmann Aug 18, 2025
b2b7a75
Merge branch 'develop' into remove_num_features
MoritzWillmann Aug 19, 2025
bcf378f
black
MoritzWillmann Aug 19, 2025
25dc3ce
Merge branch 'remove_num_features' of https://github.com/DennisKleinh…
Aug 20, 2025
1969ec2
change the `LowLevelQNN` to accept `num_features` to initialize the q…
Aug 20, 2025
b3d7b56
fix tests
MoritzWillmann Aug 20, 2025
3b50898
fix num_features for pruned encoding circuit
MoritzWillmann Aug 20, 2025
c6d2f7c
fix get_params for qrc
MoritzWillmann Aug 20, 2025
6a388f7
fix docs
MoritzWillmann Aug 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions docs/user_guide/encoding_circuits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ each gate is applied to all qubits.
The package facilitate a fully automated pruning algorithm to remove redundant parameters and
enables the automatic differentiation of arbitrary derivative.

The following functions and classes are are accessible via :class:`squlearn.encoding_circuit`.
The following functions and classes are accessible via :class:`squlearn.encoding_circuit`.

Implemented Quantum Encoding Circuits
--------------------------------------
Expand Down Expand Up @@ -47,8 +47,8 @@ Feel free to contribute to sQUlearn by adding your own encoding circuits in a Pu
.. jupyter-execute::

from squlearn.encoding_circuit import HubregtsenEncodingCircuit
pqc = HubregtsenEncodingCircuit(num_qubits=4, num_features=2, num_layers=2)
pqc.draw(output="mpl")
pqc = HubregtsenEncodingCircuit(num_qubits=4, num_layers=2)
pqc.draw(output="mpl", num_features=2)


Combining Quantum Encoding Circuits
Expand All @@ -67,11 +67,11 @@ equal to the sum of the parameters in the two original encoding circuits.
.. jupyter-execute::

from squlearn.encoding_circuit import HubregtsenEncodingCircuit, ChebyshevPQC
fm1 = HubregtsenEncodingCircuit(num_qubits=4, num_features=2, num_layers=1, closed=False)
fm2 = ChebyshevPQC(num_qubits=4, num_features=3, num_layers=1)
fm1 = HubregtsenEncodingCircuit(num_qubits=4, num_layers=1, closed=False)
fm2 = ChebyshevPQC(num_qubits=4, num_layers=1)
# Combining both encoding circuits
fm3 = fm1 + fm2
fm3.draw(output="mpl")
fm3.draw(output="mpl", num_features=2)


Wrapping Qiskit Encoding Circuits
Expand Down Expand Up @@ -108,14 +108,14 @@ the :class:`LayeredEncodingCircuit` class.

from squlearn.encoding_circuit import LayeredEncodingCircuit
from squlearn.encoding_circuit.layered_encoding_circuit import Layer
encoding_circuit = LayeredEncodingCircuit(num_qubits=4,num_features=2)
encoding_circuit = LayeredEncodingCircuit(num_qubits=4)
encoding_circuit.H()
layer = Layer(encoding_circuit)
layer.Rz("x")
layer.Ry("p")
layer.cx_entangling("NN")
encoding_circuit.add_layer(layer,num_layers=3)
encoding_circuit.draw(output="mpl")
encoding_circuit.add_layer(layer, num_layers=3)
encoding_circuit.draw(output="mpl", num_features=2)


**Example: Create your custom layered encoding circuit from a string**
Expand All @@ -124,9 +124,9 @@ the :class:`LayeredEncodingCircuit` class.

from squlearn.encoding_circuit import LayeredEncodingCircuit
encoding_circuit = LayeredEncodingCircuit.from_string(
"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
"Ry(p)-3[Rx(p,x;=y*np.arccos(x),{y,x})-crz(p)]-Ry(p)", num_qubits=4, num_layers=2
)
encoding_circuit.draw(output="mpl")
encoding_circuit.draw(output="mpl", num_features=1)


Pruning of Quantum Encoding Circuits
Expand All @@ -152,6 +152,7 @@ sQUlearn features a fully automated pruning algorithm which can be used by calli
from squlearn.encoding_circuit import LayeredEncodingCircuit, automated_pruning
from squlearn.util import Executor
encoding_circuit = LayeredEncodingCircuit.from_string("Rz(p)-Ry(p)-Z-Ry(p)-Rz(p)", num_qubits=2, num_features=0)
encoding_circuit._build_layered_pqc(0)
pruned_encoding_circuit = automated_pruning(encoding_circuit, Executor())
pruned_encoding_circuit.draw(output="mpl")

Expand Down Expand Up @@ -184,8 +185,8 @@ is utilized for the arithmetic operations of the derivatives.
.. jupyter-execute::

from squlearn.encoding_circuit import HubregtsenEncodingCircuit, EncodingCircuitDerivatives
fm = HubregtsenEncodingCircuit(num_qubits=2, num_features=2, num_layers=2)
fm_deriv = EncodingCircuitDerivatives(fm)
fm = HubregtsenEncodingCircuit(num_qubits=2, num_layers=2)
fm_deriv = EncodingCircuitDerivatives(fm, num_features=2)
# From String (gradient of the parameter vector)
grad_from_string = fm_deriv.get_derivative("dp")
# From Tuple (second order derivative of the parameter vector; equal to the Hessian)
Expand All @@ -202,8 +203,7 @@ To transpile a quantum encoding circuit, you can leverage the functionality prov
:class:`TranspiledEncodingCircuit` class. By utilizing this class, you can input an existing
quantum encoding circuit and have its circuit transpiled according to the specified backend and
transpiler settings, which are the same settings used in Qiskit.
The transpiled encoding circuit is internally employed in the QNN program and projected kernels,
where it is employed internally.
The transpiled encoding circuit is internally employed in the QNN program and projected kernels.

**Example: Transpile a existing Encoding Circuit to a fake backend**

Expand All @@ -212,6 +212,11 @@ where it is employed internally.
from squlearn.encoding_circuit import TranspiledEncodingCircuit,ChebyshevRx
from qiskit_ibm_runtime.fake_provider import FakeManilaV2

fm = TranspiledEncodingCircuit(ChebyshevRx(3,1),backend=FakeManilaV2(),initial_layout=[0,1,4])
fm.draw(output="mpl")
fm = TranspiledEncodingCircuit(
ChebyshevRx(3,1),
backend=FakeManilaV2(),
num_features=1,
initial_layout=[0,1,4]
)
fm.draw(output="mpl", num_features=1)

6 changes: 3 additions & 3 deletions docs/user_guide/executor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ We set up a small :class:`QNNRegressor <squlearn.qnn.QNNRegressor>` example and
backends = [FakeBelemV2(), FakeAthensV2(), FakeManilaV2()]
executor = Executor(backends, shots=10000)
qnn = QNNRegressor(
ChebyshevPQC(2, 1),
ChebyshevPQC(2),
SummedPaulis(2),
executor,
SquaredLoss(),
Expand All @@ -392,15 +392,15 @@ the mode is switched to ``"speed"``. The :class:`Executor <squlearn.Executor>` i
from squlearn import Executor
from qiskit_ibm_runtime import QiskitRuntimeService
from squlearn.encoding_circuit import ChebyshevRx
from squlearn.kernel import FidelityKernel, QKRR
from squlearn.kernel.lowlevel_kernel import FidelityKernel, QKRR

# Executor is initialized with a service, and considers all available backends
# (except simulators)
service = QiskitRuntimeService(channel="ibm_quantum", token="INSERT_YOUR_TOKEN_HERE")
executor = Executor(service, auto_backend_mode="speed")

# Create a QKRR model with a FidelityKernel and the ChebyshevRx encoding circuit
qkrr = QKRR(FidelityKernel(ChebyshevRx(4,1),executor))
qkrr = QKRR(FidelityKernel(ChebyshevRx(4),executor))

# Backend is automatically selected based on the smallest queue
# All the following functions will be executed on the selected backend
Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide/kernel_methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ In sQUlearn a FQK (instance) can be defined as shown by the following example:
from squlearn.util import Executor
from squlearn.encoding_circuit import ChebyshevPQC
from squlearn.kernel import FidelityKernel
enc_circ = ChebyshevPQC(num_qubits=4, num_features=1, num_layers=2)
enc_circ = ChebyshevPQC(num_qubits=4, num_layers=2)
fqk_instance = FidelityKernel(
encoding_circuit=enc_circ,
executor=Executor()
Expand Down Expand Up @@ -211,7 +211,7 @@ the following example:
from squlearn.util import Executor
from squlearn.encoding_circuit import ChebyshevPQC
from squlearn.kernel import ProjectedQuantumKernel
enc_circ = ChebyshevPQC(num_qubits=4, num_features= 1, num_layers=2)
enc_circ = ChebyshevPQC(num_qubits=4, num_layers=2)
pqk_instance = ProjectedQuantumKernel(
encoding_circuit=enc_circ,
executor=Executor(),
Expand Down Expand Up @@ -255,7 +255,7 @@ training and test data and shows how to optimize kernels.
from squlearn.kernel.loss import TargetAlignment

# set up the encoding circuit
encoding_circuit = ChebyshevPQC(num_qubits=4, num_features=1, num_layers=2)
encoding_circuit = ChebyshevPQC(num_qubits=4, num_layers=2)

# set up the quantum kernel
pqk_instance = ProjectedQuantumKernel(encoding_circuit, Executor())
Expand Down
7 changes: 6 additions & 1 deletion docs/user_guide/observables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ The map can be for example obtained in the transpiled encoding circuit.
from squlearn.encoding_circuit import ChebyshevRx,TranspiledEncodingCircuit
from squlearn.observables import SummedPaulis
from qiskit_ibm_runtime.fake_provider import FakeManilaV2
fm = TranspiledEncodingCircuit(ChebyshevRx(3,1),backend=FakeManilaV2(),initial_layout=[0,1,4])
fm = TranspiledEncodingCircuit(
ChebyshevRx(3,1),
backend=FakeManilaV2(),
num_features=1,
initial_layout=[0,1,4]
)
ob = SummedPaulis(num_qubits=3, op_str="Z")
print("Observable before mapping:\n",ob,"\n\n")
ob.set_map(fm.qubit_map, fm.num_physical_qubits)
Expand Down
10 changes: 5 additions & 5 deletions docs/user_guide/quantum_neural_networks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ method:

from squlearn.encoding_circuit import ChebyshevPQC

pqc = ChebyshevPQC(num_qubits = 4, num_features = 1, num_layers = 2)
pqc.draw("mpl")
pqc = ChebyshevPQC(num_qubits = 4, num_layers = 2)
pqc.draw("mpl", num_features = 1)

There are several alternative encoding circuits at your disposal in sQUlearn, which you can
explore in the user guide located at :ref:`quantum_encoding_circuits`.
Expand Down Expand Up @@ -136,7 +136,7 @@ and the Adam optimizer for optimization.
from squlearn import Executor

op = SummedPaulis(num_qubits = 4)
pqc = ChebyshevPQC(num_qubits = 4, num_features = 1, num_layers = 2)
pqc = ChebyshevPQC(num_qubits = 4, num_layers = 2)
qnn = QNNRegressor(pqc, op, Executor(), SquaredLoss(), Adam())

The QNN can be trained utilizing the :meth:`fit <squlearn.qnn.QNNRegressor.fit>` method:
Expand Down Expand Up @@ -314,7 +314,7 @@ yields a high variance in the model output.
from squlearn.optimizers import SLSQP
nqubits = 4
number_of_layers = 2
pqc = ChebyshevRx(nqubits, 1, num_layers=number_of_layers)
pqc = ChebyshevRx(num_qubits=nqubits, num_layers=number_of_layers)
exe = Executor("pennylane", seed=0)
exe.set_shots(5000)
ising_op = IsingHamiltonian(nqubits, I="S", Z="S", ZZ="S")
Expand Down Expand Up @@ -379,7 +379,7 @@ in the model, as depicted in `figure_qnn 3`_.
from squlearn.optimizers import SLSQP
nqubits = 4
number_of_layers = 2
pqc = ChebyshevRx(nqubits, 1, num_layers=number_of_layers)
pqc = ChebyshevRx(num_qubits=nqubits, num_layers=number_of_layers)
exe = Executor("qasm_simulator")
exe.set_shots(5000)
ising_op = IsingHamiltonian(nqubits, I="S", Z="S", ZZ="S")
Expand Down
8 changes: 4 additions & 4 deletions docs/user_guide/quantum_reservoir_computing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ is done in sQUlearn by the :class:`EncodingCircuit` class. For details we refer

from squlearn.encoding_circuit import ChebyshevPQC

pqc = ChebyshevPQC(num_qubits=8, num_features=2, num_layers=2)
pqc.draw("mpl")
pqc = ChebyshevPQC(num_qubits=8, num_layers=2)
pqc.draw("mpl", num_features=2)

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`.
The parameters are all randomly chosen. Next we also initialize our executor and QRCClassifier:
Expand Down Expand Up @@ -183,8 +183,8 @@ This time, we choose the :class:`~squlearn.encoding_circuit.HubregtsenEncodingCi

from squlearn.encoding_circuit import HubregtsenEncodingCircuit

pqc = HubregtsenEncodingCircuit(num_qubits=10, num_features=1, num_layers=2)
pqc.draw("mpl")
pqc = HubregtsenEncodingCircuit(num_qubits=10, num_layers=2)
pqc.draw("mpl", num_features=1)


The :class:`QRCRegressor` similar to the classifier example, takes our prepared :class:`EncodingCircuit` and a machine learning method
Expand Down
31 changes: 15 additions & 16 deletions examples/encoding_circuits/layered_encoding_circuit.ipynb

Large diffs are not rendered by default.

Loading