Variational Quantum Classifiers: Similar to classical machine learning, in VQCs, you pass training data through the model. The model then learns to spot patterns and as you continue training, it gets better and better.
But unlike classical ML, in VQCs you pass state vectors(eg. |0101>) through the circuit.
The model above is the VQC circuit. I used it for identifying if
the number of 1s in the input are even or odd.
Pipeline
- Convert the given input into a vector state.
- Apply rotation on each qubit and CNOT gate on every qubit to entangle them.
- Update the weights and bias according to gradient:
- Then the new weights and bias are:
- Repeat the steps for however many times on the training data (I did for 100) until you get accurate answers.
Output on unseen test data
x = [0 0 0 0], y = -1, pred = -1.0
x = [0 0 1 1], y = -1, pred = -1.0
x = [1 0 1 0], y = -1, pred = -1.0
x = [1 1 1 0], y = 1, pred = 1.0
x = [1 1 0 0], y = -1, pred = -1.0
x = [1 1 0 1], y = 1, pred = 1.0
Accuracy on unseen data: 1.0

Top comments (0)