Expand description
Phasor-feature classifier — the quantum kernel, deployed (wai.quantum.kernel).
A quantum kernel K(x,x') = |⟨ψ(x)|ψ(x')⟩|² is, by the Schuld–Sweke–Meyer
identity, a shift-invariant kernel whose Fourier spectrum is set by the data
encoding — and random Fourier features are its classical realization: draw
random frequencies ω, map x ↦ φ(x) = √(2/D)·cos(ω·x + b) (a bank of phasors,
the FHRR feature map), and ⟨φ(x),φ(x')⟩ ≈ K(x,x') (Rahimi–Recht). The
dequantization theorems say this matches the quantum kernel whenever the
spectrum is compact. So the “quantum kernel” ships as an ordinary phasor layer:
train a linear model on the phasor features and it separates data a linear model
cannot — the supervised counterpart to the generative Born machine, deployable
on a laptop, and at qFHRR phase resolution for the edge.
Every phasor evaluation is a counted operation (feature_ops) — the hook for
pricing interference computing in joules. Deterministic f64.
Structs§
- Rff
- A random-Fourier-feature (phasor) map approximating a Gaussian kernel
exp(-γ·|x−x'|²).
Functions§
- accuracy
- Classification accuracy on
(x, y). - accuracy_
quantized - Accuracy using
bits-bit qFHRR features (the edge-deployable path). - circles
- Concentric circles: inner disc (−1) vs outer ring (+1). Not linearly separable.
- feature_
ops - Phasor operations to featurize
n_samples:D · (dim + 1)per sample — the count a joule meter prices. - features
- The phasor feature vector
φ(x). - features_
quantized φ(x)with each phasor phase snapped tobits-bit qFHRR resolution.- fit_
ridge - Fit a ridge classifier on phasor features:
w = (ΦᵀΦ + λI)⁻¹ Φᵀ y. Labelsyin{−1,+1}; predictsign(w·φ(x)). - sample_
rff - Sample a phasor feature map:
d_featuresfrequenciesω ~ N(0, 2γ·I)and uniform phase biases. Deterministic inseed. - score
- The raw decision score
w·φ(x). - xor_
data - XOR clusters at
(±1,±1), labelsign(x1·x2). Not linearly separable.