Kernel estimation in QML workflows

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

Once a feature map is fixed, the kernel is an operational quantity: overlaps, fidelities, and shot budgets decide how precisely you fill a Gram matrix. The adjoint trick rewrites kernel entries as survival probability of an all-zero string after inverse encoding, and SWAP-test statistics link to fidelity.

Finite shots add variance; hardware noise biases overlaps. Reporting a kernel value without uncertainty is as risky as reporting a mean without error bars.

University approvals: 0
Tasks
Question 1

Which identity underlies the adjoint-trick estimate of the quantum kernel?

Hint

Rewrite the overlap between encoded states using the reference state.

Question 2

After preparing $U_\phi(x)^\dagger U_\phi(y)|0\ldots 0\rangle$, what does the probability of measuring $0\ldots 0$ equal in the ideal setting?

Hint

Use the Born rule.

Question 3

In the SWAP test for pure states, if $P(\mathrm{anc}=0)=0.9$, what is the fidelity $F$?

Hint

Use $P(\mathrm{anc}=0)=(1+F)/2$.

Question 4

For $N$ samples, how many pairwise kernel evaluations are needed to fill the upper triangle, including the diagonal, of a symmetric Gram matrix?

Hint

Count pairs with $i \leq j$.

Question 5

Implement fidelity_from_swap_p0(p0: float) -> float given $p_0 = (1+F)/2$ for pure states. Clamp logically: if p0 not in $[0,1]$, raise ValueError. Return $F=2p_0-1$.

Hint

Rearrange the SWAP-test identity.

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: 0 users
Creator
Pavel
Pavel