Quantum Multiclass Classification
Quantum Multiclass Classification
Extend the VQC to three classes by measuring three observables and applying softmax with a trainable scaling factor.
An educational research project on small data and quantum simulation: the results measure the model's behaviour in this setting only, and prove no quantum advantage.
The notebook and Google Colab
02-vqc-multiclass-classification.ipynb — The notebook ran in full without errors (2026-11-20 08:11 UTC, 19 s on CPU)
The notebook has not yet been published in a public GitHub repository, so we do not give a direct Colab link. Download the notebook, then open it from Colab via "File → Upload notebook".
The notebook's twelve sections
- Project title
- Problem statement
- Installing the libraries
- Importing the libraries
- data loading
- Preprocessing
- Building the quantum model
- Training
- Evaluation
- Charts
- Results
- References
The notebook runs on a CPU without a GPU, and pins the versions it was tested with in its first cell.
Research problem
How do we turn expectation values bounded in [−1, 1] into a probability distribution over several classes, and what is the effect of the scaling factor on convergence?
Objectives
- Design a multi-class output from quantum measurements.
- Train with categorical cross-entropy.
- Analyse the confusion matrix and where errors occur.
| Data | Iris (Fisher 1936) — scikit-learn / UCI Machine Learning Repository CC BY 4.0 Source |
|---|---|
| Architecture | 4 features → $R_Y$ → StronglyEntanglingLayers (3 layers) → $s\cdot(\langle Z_0\rangle,\langle Z_1\rangle,\langle Z_2\rangle)$ → softmax |
| Tools | PennyLane 0.45.1 · scikit-learn 1.9.1 · Matplotlib |
| Evaluation metrics | Accuracy · Per-class Precision/Recall/F1 · Confusion Matrix · Training Time |
Method
- Load the full Iris dataset.
- A stratified split and scaling on training data only.
- Build the circuit and the multi-class output.
- Train for 80 epochs.
- Evaluate accuracy and the classification report.
- Plot the loss and the confusion matrix.
Linked interactive experiment
References
- Maria Schuld; Alex Bocharov; Krysta M. Svore; Nathan Wiebe (2020). Circuit-centric quantum classifiers. Phys. Rev. A 101:032308 doi:10.1103/PhysRevA.101.032308
- Adrián Pérez-Salinas; Alba Cervera-Lierta; Elies Gil-Fuster; José I. Latorre (2020). Data re-uploading for a universal quantum classifier. Quantum 4, 226 doi:10.22331/q-2020-02-06-226
- R. A. Fisher (1936). The use of multiple measurements in taxonomic problems. Annals of Eugenics 7(2):179–188 doi:10.1111/j.1469-1809.1936.tb02137.x
