Skip to main content

Production-grade explainable quantum machine learning library

Project description

quantum-xai

quantum-xai is a production-first Explainable Quantum ML library with a deterministic default backend and optional real-quantum adapters.

Install

pip install quantum-xai

Optional quantum backends:

pip install "quantum-xai[pennylane]"
pip install "quantum-xai[qiskit]"

Production Quickstart (Pipeline API)

from quantum_xai import ExplainerConfig, ModelConfig, QuantumXAIPipeline

pipeline = QuantumXAIPipeline(
    model_config=ModelConfig(n_features=4, backend="lightweight", random_state=42),
    explainer_config=ExplainerConfig(shap_n_samples=32, lime_n_samples=120),
)

result = pipeline.run(dataset="iris", n_samples=80, epochs=20, lr=0.08)
print(result.model_accuracy)
print(result.benchmark_metrics)

Multiclass

Use n_classes=3 with full Iris or Wine data:

from quantum_xai import ModelConfig, QuantumXAIPipeline

pipeline = QuantumXAIPipeline(ModelConfig(n_features=4, n_classes=3, random_state=42))
result = pipeline.run(dataset="iris", n_samples=90, epochs=20)
print(result.predictions[:5])

CLI

quantum-xai run --dataset iris --n-samples 80 --epochs 20
quantum-xai run --dataset iris --n-classes 3 --n-samples 90 --epochs 20
quantum-xai run --dataset iris --model-path model.json --explanations-path explanations.json

Public API

  • QuantumXAIPipeline
  • ModelConfig, ExplainerConfig, PipelineRunResult
  • QuantumNeuralNetwork
  • QuantumSHAPExplainer, QuantumGradientExplainer, QuantumLIMEExplainer, QuantumPerturbationExplainer
  • QuantumXAIVisualizer
  • QuantumDatasetLoader
  • QuantumXAIBenchmark
  • QuantumXAIResearch
  • save_model, load_model, save_explanations, load_explanations
  • QuantumXAIError, ValidationError, ConfigurationError, BackendUnavailableError, PersistenceError

Backend Selection

  • backend="lightweight" (default): deterministic, hardware-free, CI-friendly.
  • backend="pennylane": optional PennyLane-backed transform execution.
  • backend="qiskit": optional Qiskit-backed transform execution.

If optional dependencies are missing, the library raises BackendUnavailableError with installation guidance.

Validation and Persistence

  • Strong validation for shapes, labels, indices, and config values.
  • Artifact persistence uses schema versioning (schema_version=1.0) and strict load checks.

Quality Commands

pip install -e ".[dev]"
quantum-xai run --dataset iris --n-samples 60 --epochs 5
ruff check .
black --check .
isort --check-only .
pytest
python -m build
twine check dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantum_xai-0.4.0.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quantum_xai-0.4.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file quantum_xai-0.4.0.tar.gz.

File metadata

  • Download URL: quantum_xai-0.4.0.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for quantum_xai-0.4.0.tar.gz
Algorithm Hash digest
SHA256 68dde2d04e79b263165b2f7c977ff2ba034a69d591c81622c6dd661bdc1d5e06
MD5 a529f9091bff0dff2a3fb6399c48d584
BLAKE2b-256 93a4669bcf84c63692313a465abe1a4fabd689425152ec09e037d4df30c0a3e4

See more details on using hashes here.

File details

Details for the file quantum_xai-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: quantum_xai-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for quantum_xai-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 469c839023435d38ea14c1cc5e5f12ada5d6898c16098d56b1bad88a89732b12
MD5 bb5762c79f17a40bcec04d33e42ee3c1
BLAKE2b-256 7a0a8dbcf6920b0c0bf2499c08f8549c616b6e0a41f77553004f3d5d923cd485

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page