Uncertainty Quantification for Quantum Machine Learning (PennyLane & Qiskit).
Project description
QuantumUQ
Uncertainty Quantification for Quantum Machine Learning on PennyLane and Qiskit.
Documentation: https://quantumuq.readthedocs.io/en/latest/
Installation
pip install quantumuq
# With optional Qiskit Aer support:
pip install "quantumuq[aer]"
Quick examples
PennyLane:
from quantumuq import wrap_qnode, ShotBootstrap
import pennylane as qml
import numpy as np
dev = qml.device("default.qubit", wires=2, shots=1000)
@qml.qnode(dev)
def circuit(x, params):
qml.AngleEmbedding(x, wires=[0, 1])
qml.StronglyEntanglingLayers(params, wires=[0, 1])
return qml.probs(wires=[0, 1])
params = 0.1 * np.random.default_rng(0).standard_normal((1, 2, 3))
predictor = wrap_qnode(circuit, task="classification", n_classes=2, params=params)
uq = ShotBootstrap(n_samples=16, shots=1000, seed=0)
uq_model = predictor.with_uq(uq)
dist = uq_model.predict_dist(np.random.randn(4, 2))
print(dist.mean.shape, dist.std.shape)
Qiskit:
from quantumuq import wrap_qiskit_sampler, ShotBootstrap
from qiskit.primitives import Sampler
from qiskit.circuit import QuantumCircuit
import numpy as np
qc = QuantumCircuit(1)
qc.ry(0.0, 0)
qc.measure_all()
def feature_map(X: np.ndarray):
return [[float(x[0])] for x in np.atleast_2d(X)]
sampler = Sampler()
predictor = wrap_qiskit_sampler(
sampler,
circuit=qc,
task="classification",
n_classes=2,
feature_map=feature_map,
)
uq = ShotBootstrap(n_samples=8, shots=1000, seed=0)
uq_model = predictor.with_uq(uq)
dist = uq_model.predict_dist(np.random.randn(4, 1))
print(dist.mean.shape, dist.std.shape)
Methods & metrics
- Uncertainty methods:
ShotBootstrap,DeepEnsemble,NoiseProfile - Metrics (classification):
nll,brier,ece,predictive_entropy - Metrics (regression):
rmse,gaussian_nll
Roadmap (v0.2 ideas)
- Richer model adapters (more flexible outputs, calibration hooks)
- Additional metrics and visualization utilities
- Optional integrations with experiment tracking tools
License
MIT License. See LICENSE for details.
Citation
If you use QuantumUQ in academic work, please cite:
@misc{quantumuq2026,
title = {QuantumUQ: Uncertainty Quantification for Quantum Machine Learning},
author = {Catak, Ferhat Ozgur},
year = {2026},
note = {Python library, version 0.1.0},
howpublished = {\url{https://github.com/ocatak/QuantumUQ}}
}
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quantumuq-0.1.0.tar.gz.
File metadata
- Download URL: quantumuq-0.1.0.tar.gz
- Upload date:
- Size: 266.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da1090928ed854d1137511a1e234d802dde50e6a557efeba532a7482fe6f46bc
|
|
| MD5 |
c7182f8a2d6d08cbbc67484d59ad3391
|
|
| BLAKE2b-256 |
9f1f7637ff430ccb536988034d54c2cde6a98003908009b9aa83fb95ca22e32a
|
File details
Details for the file quantumuq-0.1.0-py3-none-any.whl.
File metadata
- Download URL: quantumuq-0.1.0-py3-none-any.whl
- Upload date:
- Size: 279.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
355246d27c4ee38824418f72d3a23bd2405580f0e26f2472e61d7efe4157cd7b
|
|
| MD5 |
f988661f95abf0fc1b344bf3eca812ae
|
|
| BLAKE2b-256 |
8f9d42c1a5e7a2fb6d39824095e7af7f68e2fe0a55ebe9cb9578e5494908cc31
|