Checkpoint: Train a QML Model
This checkpoint assembles the whole module into one runnable model: a two-qubit variational classifier with data encoding, a trainable entangling ansatz, and a measured readout. You build the forward pass of the model with its trained parameters and read out the measurement statistics that the classifier uses to decide a label.
The model you are building
For a two-feature point , the circuit is
with the pieces drawn from earlier lessons:
- Encoding — angle encoding, one feature per qubit.
- Trainable ansatz : a layer of single-qubit rotations followed by a entangler. Entanglement lets the two features interact, which a product feature map cannot do on its own.
- Readout: measure both qubits. The output bit distribution is what a downstream rule turns into a class label and a confidence.
Concrete instance
Use the data point and trained parameters
and apply the gates in this order:
- encode: on qubit 0, on qubit 1;
- ansatz rotations: on qubit 0, on qubit 1;
- entangler: with control qubit 0, target qubit 1;
- measure both qubits.
What the grader checks
The grader compares the full measurement distribution over the four outcomes to the distribution produced by the correct circuit. The probabilities follow from the Born rule applied to the prepared state, so getting the gate order, angles, and entangler right is the whole task. An identity or missing-CNOT circuit will produce a different distribution and fail.
Try it
Build the two-qubit variational classifier described above for and trained angles , then measure both qubits.
Sign in on the full site to ask questions and join the discussion.