Skip to content
Back to skills

Algorithms

ASecurity

"Train, evaluate, persist, and troubleshoot Qiskit Machine Learning

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
businesspythonrustgoapibackend

Works with

  • api

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 6 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill algorithms --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Algorithms?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Algorithms
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-algorithms/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-algorithms)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: algorithms
description: "Train, evaluate, persist, and troubleshoot Qiskit Machine Learning
  classifiers, regressors, and quantum Bayesian inference with public
  scikit-learn-like APIs."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# Algorithms

Use this route for end-to-end model work: choose a classifier or regressor,
prepare compatible `X`/`y`, attach a primitive and optimizer, call `fit`,
`predict`, and `score`, observe callbacks, continue with warm starts, persist a
model, or run `QBayesian` inference. Read the focused references progressively:

- [api-reference.md](references/api-reference.md) for public constructors,
  shapes, outputs, and loss choices.
- [workflows.md](references/workflows.md) for classification, regression,
  kernel-model, Bayesian, primitive, callback, and warm-start procedures.
- [model-persistence.md](references/model-persistence.md) before saving,
  loading, or changing a primitive after loading.
- [troubleshooting.md](references/troubleshooting.md) when validation,
  primitive, layout, shape, or convergence errors occur.
- [`scripts/vqc_smoke.py`](scripts/vqc_smoke.py) for a tiny deterministic
  VQC/ad-hoc-data check that is safe to invoke from any current directory.

## Scope and routing

- **Own here:** `VQC`, `VQR`, `NeuralNetworkClassifier`,
  `NeuralNetworkRegressor`, `QSVC`, `QSVR`, `PegasosQSVC`, `QBayesian`,
  `TrainableModel`, objective/loss selection, `fit`/`predict`/`score`,
  callbacks, warm starts, and dill persistence.
- **Route raw QNN construction, parameter ordering, forward/backward, or
  gradient design** to `qnn-gradients`.
- **Route direct fidelity/statevector-kernel construction, matrix policy,
  trainable kernels, and kernel trainers** to `kernels-fidelity`. This route
  only explains the model-facing QSVC/QSVR contract.
- **Route optimizer catalog, support levels, SPSA/QNSPSA, and detailed
  optimizer tuning** to `optimizers`; choose only the model attachment here.
- **Route dataset generation, circuit helpers, and TorchConnector/PyTorch**
  to `data-circuits-connectors`.

## Operating procedure

1. Install the public package in the target environment with
   `python -m pip install qiskit-machine-learning`; add only required public
   optional extras. Do not assume a source checkout or a private import path.
2. Make `X` a numeric two-dimensional array `(n_samples, n_features)` and
   make its feature dimension match the feature-map data parameters/qubits.
   Keep a separate held-out set for a meaningful score.
3. Select the output representation before choosing the loss: sampler-based
   VQC produces class probabilities; estimator-based VQR produces observable
   expectations. Use the exact label/output shapes in `api-reference.md`.
4. Choose a bounded optimizer budget for a smoke or pilot run. Set
   `algorithm_globals.random_seed` when deterministic initialization or
   sampling matters. A successful `fit` returns `self`; inspect `weights` or
   `fit_result` only after fitting.
5. For V2/runtime primitives, use a compatible `pass_manager` for circuits that
   require ISA transpilation. Preserve measurements for sampler circuits and
   keep observables layout-aligned for estimator circuits; see the migration
   sharp bits in `troubleshooting.md`.
6. Validate on `score` and inspect prediction shape/content, not only an
   optimizer objective. Classification score is mean accuracy; regression
   score is the coefficient of determination (`R^2`).
7. Before persistence, record package/runtime versions, data preprocessing,
   feature map/ansatz or kernel, primitive/backend, pass manager, seed, loss,
   optimizer settings, and callback behavior. Treat dill files as trusted
   executable artifacts.

## Fast decisions

| Need | First choice | Critical contract |
|---|---|---|
| Variational classification | `VQC` | one-hot class probabilities; default `cross_entropy` |
| Variational scalar regression | `VQR` | estimator expectation target; default `squared_error` |
| Kernel classification | `QSVC` | pass `quantum_kernel=...`, never `kernel=...` |
| Kernel regression | `QSVR` | raw features or correctly shaped precomputed matrices |
| Large-step binary kernel classification | `PegasosQSVC` | binary labels; `num_steps` has no early stopping |
| Conditional probabilities | `QBayesian` | one-qubit named registers and binary evidence |

For a concrete recipe and recovery actions, read the references rather than
copying private implementation details. Do not claim a statevector smoke
proves a vendor backend, shot noise, cloud session, or optional dependency.

Files in this skill

  • SKILL.md4.5 KB
  • references/api-reference.md6.9 KB
  • references/model-persistence.md3.5 KB
  • references/troubleshooting.md6.1 KB
  • references/workflows.md7 KB
  • scripts/vqc_smoke.py2.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.