Computing Library › Quantum Ml
Quantum Ml

Quantum Feature Maps

A quantum feature map embeds classical data into a high-dimensional quantum Hilbert space, where linear separations may correspond to nonlinear boundaries in the original space.

The core idea

In classical machine learning a feature map phi(x) sends an input vector x into a higher-dimensional space where a linear model can separate classes that were entangled in the original coordinates. A quantum feature map does the same job with a circuit: it takes a data-dependent unitary U(x) and prepares the state |phi(x)> = U(x)|0...0>. The image of the data lives in the Hilbert space of n qubits, which has dimension 2^n.

The map is only useful if the embedding respects structure in the data. A common construction applies single-qubit rotations proportional to features, then entangling gates, and often repeats the pattern to raise the polynomial degree of the accessible functions. The Havlicek-style embedding uses products of feature values in the rotation angles so that pairwise interactions appear in the state.

Kronos motion — classical vs quantum

Why the geometry matters

Two data points that are far apart classically can map to nearly orthogonal quantum states, and points that should be treated as similar can map to states with large overlap. The overlap ||^2 defines a quantum kernel, and the whole downstream model depends on whether that kernel encodes a meaningful notion of similarity for the task.

A minimal example

python
# Angle-style feature map on 2 qubits (schematic, PennyLane-like)
def feature_map(x):
    for i in range(2):
        qml.Hadamard(wires=i)
        qml.RZ(x[i], wires=i)
    qml.CNOT(wires=[0, 1])
    qml.RZ((pi - x[0]) * (pi - x[1]), wires=1)
    qml.CNOT(wires=[0, 1])
# The final state |phi(x)> encodes products of features via the ZZ term.

Design tensions

A feature map is a modeling choice, not a free lunch. The right question is whether its induced similarity measure matches the problem, and whether that measure is hard to reproduce classically. Both must hold for the embedding to earn its place.