Python package for quantum reservoir computing using Qulacs
Project description
Qreservoir
Qreservoir is a lightweight python package built on top of qulacs to simulate quantum extreme learning and quantum reservoir computing models.
Qreservoir is licensed under the MIT license.
Tutorial and API documents
Documentation and API: https://owenagnel.github.io/qreservoir.
Quick Install for Python
pip install qreservoir
Uninstall Qreservoir:
pip uninstall qreservoir
Features
Fast simulation of quantum extreme learning machine and quantum reservoir computing.
Python sample code
from qulacs import Observable
from sklearn.linear_model import LinearRegression
from qreservoir.datasets import Complex_Fourrier
from qreservoir.encoders import ExpEncoder
from qreservoir.models import QELModel
from qreservoir.reservoirs import RotationReservoir
dataset = Complex_Fourrier(complexity=1, size=1000, noise=0.0)
encoder = ExpEncoder(1, 1, 3) # 1 feature, 1 layer, 1 qubit per feature
reservoir = RotationReservoir(encoder, 0, 10) # 0 ancilla qubits, 10 depth
observables = [Observable(3) for _ in range(9)] # create observable set
for i, ob in enumerate(observables[:3]):
ob.add_operator(1.0, f"X {i}")
for i, ob in enumerate(observables[3:6]):
ob.add_operator(1.0, f"Z {i}")
for i, ob in enumerate(observables[6:]):
ob.add_operator(1.0, f"Y {i}")
model = QELModel(reservoir, observables, LinearRegression()) # observable is a qulacs Observable object
X, _, y, _ = dataset.get_train_test()
model.fit(X, y)
print(model.score(X, y))
How to cite
N/A
Future improvements
-
Model creation currently a bit clunky. Models should take encoders and reservoirs as two seperate arguments and size of inputs should be determined dynamically when fit/score are called. This is made more difficult by the fact we wish to extract variance and concentration data from the models. Ideally we want
RCModel
andQELModel
to implement scikit-learn'sBaseEstimator
interface. -
Additional tests should be written for datasets and new reservoirs/encoders
-
Improve package structure by using python specific object oriented features.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file qreservoir-0.5.0.tar.gz
.
File metadata
- Download URL: qreservoir-0.5.0.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aa803f136b10894cd9a83931c154399a2fb4ce2a14e2cb2d63f9148a85a398d |
|
MD5 | da7d4c58bd66ee76ce64cf92d500159b |
|
BLAKE2b-256 | 85fc8591913b6f35e6930fd04e3408492c586ae529ca5a9a159661b198463f20 |
File details
Details for the file qreservoir-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: qreservoir-0.5.0-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b78e63b3abcdb43a341c22cf21309c5b47e468e723ebdef560ba9c94864ec32 |
|
MD5 | 14bd808f7fd31215b9e1762f9b1fa095 |
|
BLAKE2b-256 | 9cd3468091649d723b4410a46684ac651890a554bd1df657552be934084f591f |