Overlap, fidelity, and simple feature-map kernels

Advanced Quantum Machine Learning
Created by Pavel · 17.03.2026 at 07:05 UTC · 1 completed

Kernel entries are overlaps squared—probabilities if you measure the right basis. For analytic feature maps such as $R_y(x)|0\rangle$, you can compute kernels with pen-and-paper geometry before touching a simulator.

Identical inputs should yield kernel 1 in the ideal setting; orthogonal encodings can drive the overlap to zero.

University approvals: 0
Tasks
Question 1

For pure states $|\psi\rangle$ and $|\varphi\rangle$, which expression defines fidelity?

Hint

Fidelity is a nonnegative real number in $[0,1]$.

Question 2

For the feature map $|\phi(x)\rangle = R_y(x)|0\rangle$, what is the corresponding one-qubit quantum kernel?

Hint

The overlap is a cosine of half the angle difference.

Question 3

If $x-y=\pi$ in the one-qubit feature map $|\phi(x)\rangle = R_y(x)|0\rangle$, what is the kernel value?

Hint

Substitute into $\cos^2((x-y)/2)$.

Question 4

If two inputs are identical and the same feature map is applied, what should the ideal quantum kernel value be?

Hint

A normalized state has unit overlap with itself.

Question 5

Implement ry_kernel_delta(delta: float) -> float returning $\cos^2(\Delta/2)$, the squared overlap between $R_y(x)|0\rangle$ and $R_y(x+\Delta)|0\rangle$.

Hint

math.cos(delta/2)**2

Starter code is prefilled; replace TODO blocks with your solution.
2 test cases will be used for grading
Run checks runtime behavior only. Final correctness is evaluated when you submit.
Card Info
  • Topic: Quantum Machine Learning
  • Difficulty: Advanced
  • Completed: 1 users
Creator
Pavel
Pavel