Kernel methods are a classical machine-learning idea: instead of operating on raw feature vectors,
compare data points through a kernel functionk(x,y) that measures similarity in a
high-dimensional feature space. Quantum computers can evaluate kernels that are classically hard
to compute, by using the quantum state itself as the feature vector.
The quantum kernel
Given a data-encoding unitary Uϕ(x) (a feature map), the corresponding quantum state is
∣ϕ(x)⟩=Uϕ(x)∣0⟩.
The quantum kernel between two data points x and y is the squared overlap of their
feature states:
k(x,y)=∣⟨ϕ(y)∣ϕ(x)⟩∣2.
Because the inner product lives in a Hilbert space whose dimension grows exponentially with the
number of qubits, the feature space is vastly larger than anything a classical computer can
represent explicitly.
The overlap circuit
The key insight is that k(x,y) is a measurement probability. Consider the circuit
Uϕ(y)†Uϕ(x)∣0⟩.
The probability that this state measures as ∣0⟩ is
The kernel circuit combines both rotations into a single net rotation Ry(π/3−2π/3)=Ry(−π/3),
and P(∣0⟩)=cos2(π/6)=3/4 as expected.
From a kernel to a classifier
Once a kernel matrix Kij=k(xi,xj) is available, any classical kernel method (support
vector machine, kernel ridge regression) can use it directly. The quantum computer evaluates the
matrix entries; the classical optimizer does the rest.
Try it
Build the overlap circuit for x=π/3 and y=2π/3. Apply the encoding Ry(π/3),
then the inverse encoding Ry(−2π/3), and measure. The grader checks the output
distribution: P(0) should be 3/4.
Run your code to see the quantum state.
Sign in on the full site to ask questions and join the discussion.