Skip to content

ESA-PhiLab/shotwise

Repository files navigation

ShotWise

ShotWise is a Python toolkit for adaptive measurement allocation in noisy kernel learning.

The package targets settings where kernel entries are obtained through stochastic measurements and measurement resources are limited. Rather than allocating measurements uniformly across the kernel matrix, ShotWise allocates resources where they matter most for downstream learning tasks.

Typical applications include:

  • Quantum kernel methods
  • Measurement-limited kernel learning
  • Kernelized SVMs
  • Gaussian Processes
  • Other kernel methods trained from noisy kernel estimates

Motivation

Many kernel-learning pipelines implicitly assume exact access to the kernel matrix.

In emerging settings such as quantum machine learning, this assumption no longer holds. Kernel entries must be estimated from finite numbers of measurements, introducing uncertainty that depends directly on how measurement resources are allocated.

ShotWise provides algorithms that transform measurement allocation from a uniform estimation problem into a task-aware learning problem.


First Algorithm: SupportShot

The first algorithm implemented in ShotWise is:

SupportShot — adaptive measurement allocation for kernelized Support Vector Machines.

SupportShot combines two complementary signals:

  • Margin sensitivity

    • How strongly a kernel entry influences the SVM solution.
  • Active-set instability

    • How likely support-vector membership is to change under kernel uncertainty.

These signals define an adaptive allocation policy that concentrates measurements in classifier-relevant regions of the kernel matrix.

Under fixed budgets, this can improve:

  • support-vector recovery,
  • margin estimation,
  • decision-function reconstruction,
  • overall classifier fidelity.

Associated Publication

Miroszewski, A.

Adaptive Measurement Allocation for Learning Kernelized SVMs Under Noisy Observations.

arXiv:2605.22275 (2026).


Features

  • Adaptive allocation for noisy kernel estimation
  • SupportShot algorithm for kernelized SVMs
  • Backend-agnostic architecture
  • Synthetic Bernoulli measurement backends
  • Qiskit simulator support
  • Qiskit hardware support
  • Support for adaptive, uniform, and custom allocation policies
  • Reproducible experimental and benchmarking pipeline
  • Statistical analysis utilities for large experiment campaigns

Installation

Basic installation

pip install shotwise

Development installation

git clone <repository-url>
cd shotwise

pip install -e .

Optional Qiskit support

pip install -e .[qiskit]

Qiskit + analysis tools

pip install -e .[qiskit,examples]

Authentication

ShotWise does not manage IBM Quantum authentication.

Configure your IBM Quantum account using:

qiskit_ibm_runtime save-account --token YOUR_TOKEN

or environment variables supported by Qiskit Runtime.

You can also add your IBM token with

python examples/qiskit_setup_account.py

Never store authentication tokens in source code.


Quick Start

Synthetic examples:

python examples/synthetic_backend.py
python examples/blob_benchmark.py

These examples run the adaptive allocation pipeline using synthetic noisy kernel measurements.


Hardware Experiments

Example scripts for quantum kernel experiments are available in:

examples/qiskit_toy8_simulator.py
examples/qiskit_toy8_Manila.py
examples/qiskit_toy8_ibm_shot.py

Utilities for reproducing the experimental analysis used in the accompanying papers:

examples/analyze_toy_experiments.py
examples/make_ibm_main_tables.py

Testing

Run the complete test suite:

pytest -q

Run linting:

ruff check .

Research Status

ShotWise is an active research project.

Current methods focus on adaptive measurement allocation for kernelized SVMs. Ongoing work includes:

  • Gaussian Processes
  • Additional kernel-learning methods
  • New allocation policies
  • Hardware-aware adaptive strategies
  • Resource-aware kernel learning beyond SVMs

Citation

If you use ShotWise in academic work, please cite:

@article{miroszewski2026adaptive,
  author = {Miroszewski, Artur},
  title = {Adaptive Measurement Allocation for Learning Kernelized SVMs Under Noisy Observations},
  journal = {arXiv preprint arXiv:2605.22275},
  year = {2026}
}

A machine-readable citation is also available in CITATION.cff.


License

ShotWise is released under the Apache License 2.0.

See the LICENSE file for details.

About

Adaptive Measurement Allocation for Learning Kernelized SVMs Under Noisy Observations

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages