Skip to main content

Module trainable

Module trainable 

Source
Expand description

Trainable quantum (embedding) kernels optimized by gradient ascent.

Reference: Hubregtsen, Wierichs, Gil-Fuster, Derks, Faehrmann & Meyer, “Training quantum embedding kernels on near-term quantum computers”, Phys. Rev. A 106, 042431 (2022).

A quantum embedding kernel is the fidelity kernel of a parametrized feature map |ψ_θ(x)⟩:

k_θ(x, y) = |⟨ψ_θ(x) | ψ_θ(y)⟩|².

The embedding parameters θ are trained (classically, here) to make the kernel useful for a labelled data set by maximizing the kernel-target alignment with the ideal label kernel Y_ij = y_i y_j (y_i ∈ {-1,+1}):

A(θ) = ⟨K_θ, Y⟩_F / ( ‖K_θ‖_F · ‖Y‖_F ),

the Frobenius inner product of the (centered-by-labels) Gram matrix and the outer product of the labels. We optimize A(θ) by gradient ascent; gradients are obtained with the parameter-shift rule applied to every kernel entry.

§Trainable embedding

The feature map is a single hardware-efficient layer with a per-feature trainable scale: qubit i receives Ry(θ_i · x_i), followed by a CNOT entangling ladder. The trainable scales θ let the optimizer adapt the data-dependent rotation magnitude (the dominant knob controlling the kernel’s effective bandwidth and expressivity).

Structs§

TrainableKernel
A trainable quantum embedding kernel with per-feature rotation scales θ.
TrainableKernelConfig
Configuration for kernel-alignment training.