A quantum kernel measures similarity between data points by embedding them as quantum states and
taking their overlap. The classical learner — typically a support-vector machine — never sees the
quantum state; it only sees the kernel matrix. The whole quantum content lives in the feature map.
Feature map and kernel
A feature map is a fixed (untrained) circuit that turns a classical vector x into a
state:
Φ:x⟼∣ϕ(x)⟩=UΦ(x)∣0⟩⊗n.
The kernel is the squared overlap of two such states,
k(x,x′)=⟨ϕ(x)∣ϕ(x′)⟩2,
which is a positive-definite similarity measure — exactly what a kernel SVM requires. Havlíček et
al. (2019) and Schuld & Killoran (2018) established this feature-space view of quantum models.
Angle encoding
The simplest useful feature map is angle encoding: rotate each qubit by an angle proportional to
a feature. With one qubit per feature and a Y-rotation,
The factor of 2 is conventional: with RY(2xi) the qubit's amplitude on ∣1⟩ becomes
sin(xi), so the feature xi controls the rotation angle directly. For a single qubit,
RY(2x)∣0⟩=cos(x)∣0⟩+sin(x)∣1⟩.
For a two-feature point x=(x0,x1) on two qubits the encoded state is the tensor
product
You never have the amplitudes directly. The standard trick is the overlap (inversion) test: run
UΦ(x′)†UΦ(x) on ∣0⟩ and measure the probability of
returning to ∣0⟩⊗n — that probability isk(x,x′).
The kernel matrix is filled in by repeating this over all pairs, then handed to a classical SVM.
Try it
Build the angle-encoding feature map state for the two-feature data point
x=(0.6,1.2) on two qubits, using RY(2xi) on qubit i. The grader checks the
full state vector, so the amplitudes must match
cos(0.6)cos(1.2),cos(0.6)sin(1.2),sin(0.6)cos(1.2),sin(0.6)sin(1.2).
Run your code to see the quantum state.
Sign in on the full site to ask questions and join the discussion.