Skip to main content

qml-oncology

Quantum machine learning + medical imaging for oncology. Reusable, clinically-honest formulations: variational quantum classifiers (swappable encodings and simulator / real-hardware backends), a multi-cancer-type classifier, a selective-prediction / cost-sensitive evaluation toolkit, a radiomics-to-quantum bridge, and U-Net tumor localization with 3-D rendering.

Extracted from the QuanTriage project so others can build on the same methods.

Educational / research software. Not a validated medical device.

Install

pip install qml-oncology                 # core: quantum classifiers + eval toolkit + datasets
pip install qml-oncology[imaging]        # + U-Nets, radiomics, 3-D rendering (torch, nibabel, ...)
pip install qml-oncology[hardware]       # + IBM Quantum via pennylane-qiskit
pip install qml-oncology[all]            # everything

Quick start

A clinically-honest quantum classifier

from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from qml_oncology import (FlexibleQuantumClassifier, compute_metrics,
                          cost_sensitive_threshold, selective_prediction)

X, y = load_breast_cancer(return_X_y=True)
y = (y == 0).astype(int)                       # positive class = malignant
Xtr, Xte, ytr, yte = train_test_split(X[:, :6], y, stratify=y, random_state=0)

clf = FlexibleQuantumClassifier(encoding="reupload", n_qubits=6, n_layers=4, epochs=25)
clf.fit(Xtr, ytr)
proba = clf.predict_proba(Xte)[:, 1]

# tune a threshold that treats a missed cancer as 10x worse than a false alarm
thr = cost_sensitive_threshold(yte, proba, cost_ratio=10)
print(compute_metrics(yte, proba, thr))        # accuracy, sensitivity, specificity, AUC, ...

# defer low-confidence cases to a human instead of guessing
print(selective_prediction(yte, proba, confidence=0.85))

Encodings, bigger models, real hardware

# data re-uploading or amplitude encoding, on the fast C++ simulator
m = FlexibleQuantumClassifier(encoding="amplitude", n_qubits=4, device="lightning.qubit")

# train on a simulator, then run the SAME trained circuit on real hardware
from qml_oncology import make_device   # device factory
m.predict_on_device(Xte, "qiskit.remote", shots=1024)   # IBM Quantum (needs your token)
m.predict_on_device(Xte, "braket.aws.qubit", shots=1024)  # AWS Braket (needs AWS creds)

Multi-cancer typing (5 tumor types from gene expression)

from qml_oncology import load_dataset, MultiClassQuantumClassifier
ds = load_dataset("pan_cancer_rnaseq", n_features=10)    # downloads TCGA data on first use
clf = MultiClassQuantumClassifier(n_classes=ds.n_classes, n_qubits=10, epochs=35).fit(ds.X_train, ds.y_train)

Imaging (needs [imaging]): tumor localization + 3-D render

from qml_oncology.segmentation.multimodal import build_multimodal_dataset, train_multimodal
from qml_oncology.imaging.tumor3d import build_figure          # interactive 3-D tumor render
from qml_oncology.imaging.bridge import radiomics_vector       # radiomics -> quantum circuit

What's inside

Module What
qml_oncology.quantum variational, multi-class, flexible (encodings + backends), and PyTorch hybrid classifiers
qml_oncology.evaluation cost-sensitive thresholding, selective prediction, noise robustness, permutation importance
qml_oncology.data dataset registry (breast cancer, TCGA pan-cancer RNA-seq)
qml_oncology.imaging radiomics, 3-D rendering, radiomics-to-quantum bridge
qml_oncology.segmentation 2-D / 3-D U-Nets, multi-modal MRI loaders, training

Full app, visuals, and docs: https://github.com/KMaruthi2002/QuanTriage

License

MIT

Metadata

Release files for qml-oncology 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qml-oncology 0.1.0
File Size Uploaded Provenance Actions
qml_oncology-0.1.0.tar.gz 35.7 kB With provenance Details for qml_oncology-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qml-oncology 0.1.0
File Interpreter ABI Platform Actions
qml_oncology-0.1.0-py3-none-any.whl Python 3 none any Details for qml_oncology-0.1.0-py3-none-any.whl

Total release size: 88.3 kB

Release files / qml_oncology-0.1.0.tar.gz

Download URL qml_oncology-0.1.0.tar.gz
Size 35.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9d3804366ffee1796969af57b21c07003c40b66fa88b9e61508f8123c86c2c71
BLAKE2b-256 checksum
How to use checksums
5b948e0fe5134114d3887dd4c83ae4984e7d81865d2a0b9b952e763f39e44349
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

Release files / qml_oncology-0.1.0-py3-none-any.whl

Download URL qml_oncology-0.1.0-py3-none-any.whl
Size 52.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d196c1cead33ed835e64c808ab381bbf730d4fa5e8e21688233be1f4b9a5f751
BLAKE2b-256 checksum
How to use checksums
d27de3833e11e9477b34f6c05633da5d9eb69b5889415d21a3992f674177f3d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

Security for qml-oncology 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qml_oncology-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page