Hands-on lab · 1 step
Train a one-qubit variational classifier
The circuit with observable is the smallest variational quantum classifier: feature map , ansatz , model output and prediction . Choose the single weight so that all four training points are classified correctly.
Step 1: Choose θ so that sign⟨Z⟩ reproduces every label
The circuit is fixed: with the angle given by the data symbol (parameter x, not trainable), followed by with the angle given by the weight (parameter theta). Only the value of theta may change; the gates, their order and the parameter x are locked.
The grader binds to each of the four training points, simulates the state , and predicts :
| label |
The check passes when the accuracy is , i.e. all four predictions equal their labels (an output of exactly counts as wrong). In the lesson it is shown that , so you need at and at . At the initial value the accuracy is .