Project: A Quantum Classifier
Quantum machine learning models are parameterized circuits trained like neural networks: a feature is encoded into a quantum state, a trainable unitary transforms it, and a measurement reads off the prediction. This capstone builds the smallest non-trivial example — a single-qubit data-reuploading classifier — and connects training, inference, and benchmarking.
Encoding and the model
A scalar feature is loaded by a rotation, . A trained weight is applied as a second rotation, and the label is read from a -measurement. Because both rotations share the axis,
The decision rule is a threshold on the measured probability:
Training
Training minimizes a loss — e.g. the squared error between and the true label — averaged over the dataset, by adjusting with a classical optimizer using parameter-shift gradients. For a threshold dataset where points with belong to class , the optimizer converges to , which rotates positive- points past the equator of the Bloch sphere toward .
Inference and benchmarking
At the converged weight, classify the test point :
a confident class- prediction with . Benchmarking the model means sweeping the test set, recording for each point, and reporting accuracy — the same protocol used for any classifier, quantum or classical.
Try it
Build the classifier for the test point at the trained weight and measure. The grader checks the output distribution; all probability should land on outcome .
Sign in on the full site to ask questions and join the discussion.