Laboratory 21 · Quantum feature maps · Self-directed exploration

When is a quantum feature-state similarity a valid kernel?

Construct a full matrix of state overlaps, inspect its eigenvalue spectrum, and estimate entries using sampled quantum measurements.

Complete independent study unitPositive-semidefinite Gram matrixFeature-state overlap samplingReproducible physics checks

What makes a matrix of quantum-state similarities mathematically useful?

A quantum feature map encodes classical inputs as normalized quantum states. The squared state overlap defines a positive-semidefinite kernel, which may be used in kernel methods such as regression or classification. In a one-qubit example, the function is simple enough to write down analytically, allowing direct inspection of symmetry, diagonal normalization, eigenvalue nonnegativity and the effect of finite measurement shots. This example also highlights that a large input dataset does not automatically require a large Hilbert-space model.

Make a prediction. Take identical inputs xi=xj. Predict Kij. Then choose two inputs differing by π and estimate their overlap. Does changing the shot count alter the ideal kernel or merely its measured estimate?

Prerequisites: State overlap, unitary quantum rotations, Gram matrices and positive semidefinite linear algebra.

Numerical and exact predictions

The complete quantum kernel matrix

Each input point corresponds to a one-qubit pure state. Every matrix element is the probability of a state-overlap readout.

Kij=|〈φ(xi)|φ(xj)〉|². The diagonal equals one, the matrix is real symmetric and all entries lie in [0,1]. Its eigenvalue spectrum determines algebraic rank.

Eigenvalues and effective feature rank

The squared overlap admits a low-dimensional classical feature representation in this example, which permits exact analytical conclusions about the kernel rank.

For one-qubit Ry encoding, Kij=½[1+cos(xi−xj)], a dot product of three real features. Thus rank(K)≤3 for any number of input points.

Why every overlap Gram matrix is positive semidefinite

Choose |φ(x)〉=Ry(x)|0〉. Its state overlap equals cos[(x−x′)/2], so the kernel is K(x,x′)=|〈φ(x)|φ(x′)〉|²=cos²[(x−x′)/2]. It can also be written as Tr(ρxρx′), where ρx is the rank-one density operator of the encoded state.

K(x,x′)=½[1+cos x cos x′+sin x sin x′].

Introduce the explicit real feature vector v(x)=(1,cosx,sinx)/√2. Then K(x,x′)=v(x)·v(x′). The Gram matrix of any finite collection of real feature vectors is positive semidefinite because c†Kc=||Σᵢcᵢv(xᵢ)||²≥0 for arbitrary coefficients c. In this example, all kernel matrices have rank at most three, regardless of the input sample count.

A quantum device estimates K through the probability of measuring 0 after U(x′)†U(x)|0〉. With Nshots independent Bernoulli outcomes, the sample estimate K̂ has mean K and variance K(1−K)/Nshots. The ideal Gram matrix is positive semidefinite; independently sampled entries may introduce small negative sample eigenvalues and generally require consistent symmetrization or suitable estimation methods.

An exactly soluble reference limit

Identical inputs give K=1. Input angles differing by π give orthogonal feature states and K=0. When all angles cluster tightly, nearly every entry approaches one and the kernel becomes nearly rank one. Widely distributed points can span the full three-dimensional feature space but never exceed rank three.

Assumptions and numerical reliability

Ideal single-qubit Ry encoding and fidelity-square kernel. Inputs are evenly spaced across [−L,L], with finite shots simulated for a single selected kernel entry. Any apparent computational advantage is outside this toy example, whose kernel has an elementary three-feature classical representation.

Three experiments to reason through

  1. Read the matrix. Change the input span from .5 to π and inspect which pairs become orthogonal. Explain the diagonal, symmetry and periodic similarity structure.
  2. Inspect effective rank. Raise N from 3 to 15. Count non-negligible eigenvalues and compare with the explicit three-dimensional feature vector, not merely the number of input states.
  3. Quantify shot noise. Select a nontrivial entry 0

Self-check: For the Ry(x) one-qubit fidelity kernel, what is the maximum Gram-matrix rank as the dataset size increases?

Extension: generalize the Gram proof to arbitrary density operators using the Hilbert–Schmidt inner product, and compare kernel concentration for higher-dimensional feature maps.

What the experiment means

The quantum fidelity kernel yields a mathematically valid positive-semidefinite similarity, yet model complexity and practical learning benefit require separate analysis. The small example makes the distinction between mathematical validity, representational capacity and sampling cost concrete.

Compare with the manuscript: Quantum kernels and Gram positivity · Scope and limitations.